How do I stitch these data and get a final plot
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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.
1 Kommentar
Rik
am 27 Mai 2024
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?
Antworten (1)
Mathieu NOE
am 27 Mai 2024
hello
maybe this ?
clear all
S=readmatrix ('Probe.txt');
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
D=readmatrix ('selfmeas.txt');%load the whole 2DP file
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')
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!