# How do I stitch these data and get a final plot

38 views (last 30 days)
Ankita on 27 May 2024 at 5:25
Answered: Mathieu NOE on 27 May 2024 at 15:36
this is my code
I want to take all the 61*6 X data(1st, 4th,7th...columns) , all 61*6 Y data (2nd, 5th,8th...colums) and all 61*6 Z data(3rd,6th,9th ...columns) stitch all of them and get the final surface plot of X, Y, Z. How do I do this? Can anybody please help sooner.
Rik on 27 May 2024 at 7:36
Please post your code here and attach your data in a mat file. Your text sounds like you have some array with 61 rows and 18 columns. This should be possible in one line of code. What did you try?

Mathieu NOE on 27 May 2024 at 15:36
hello
maybe this ?
clear all
T=S(:,[2,3]);
i=0;
for j=0:60:300
R=[cos(j) -sin(j);sin(j) cos(j)]; %rotation matrix
a(:,i+1:i+2)=T*R; %stores value of each x and y in separate columns for every iteration
%disp(a);
i=i+2;
end
A=D(82:447,:); %extract only the z data
j=1;
for i=1:366
if (i==j)
P(i,1)=A(j,4);
j=j+61;
else
P(i,1)=A(i,2);
end
end
z=reshape(P,[61,6]); %reshape each clocking data into separate columns
disp(z);
C = [a(:,1:2) z(:,1) a(:,3:4) z(:,2) a(:,5:6) z(:,3) a(:,7:8) z(:,4) a(:,9:10) z(:,5) a(:,11:12) z(:,6)];
disp(C);
% I want to take all the 61*6 X data(1st, 4th,7th...columns) , all 61*6 Y data (2nd, 5th,8th...colums)
% and all 61*6 Z data(3rd,6th,9th ...columns) stitch all of them and get the final surface plot of X, Y, Z.
x = C(:,1:3:end);
y = C(:,2:3:end);
z = C(:,3:3:end);
x = x(:);
y = y(:);
z = z(:);
%%%%%%
I = scatteredInterpolant(x,y,z,'linear','none');
N = 100;
x = linspace(min(x),max(x),N);
y = linspace(min(y),max(y),N);
[x,y] = meshgrid(x,y);
z = I(x,y);
surf(x,y,z);
colorbar('vert')