Ploting (x,z) and (y,z) data on same plot

조회 수: 15 (최근 30일)
Kabit Kishore
Kabit Kishore 2022년 2월 18일
댓글: Kabit Kishore 2022년 2월 22일
Hi i have multiple (x,z) and (y,z) grid data. I want to plot them on the same axis in 3D. The x and y meaurements are separated by 1 meters apart as shown in the picture attached. I am also attaching my data. Any leads for this will be appreciated. Thank you.
  댓글 수: 1
Kabit Kishore
Kabit Kishore 2022년 2월 18일
I have managed to plot line x0 and y0. However i want to plot the rest of line on this same plot which are separated by 1 meters interval in both x and y directions. This is what i have done.
scatter3(x,zeros(size(x)),z)
hold on
scatter3(zeros(size(y)),y,z1)

댓글을 달려면 로그인하십시오.

채택된 답변

Kevin Holly
Kevin Holly 2022년 2월 18일
편집: Kevin Holly 2022년 2월 18일
I'm not sure what you mean by the x and y measurements being separated by 1 meter. Below is a guess at want you want. Please clarifiy.
x0 = readtable('x0.xlsx');
x1 = readtable('x1.xlsx');
y0 = readtable('y0.xlsx');
y1 = readtable('y1.xlsx');
plot3(x0.x,zeros(length(x0.x)),x0.z)
hold on
plot3(x1.x,ones(length(x1.x)),x1.z)
plot3(zeros(length(y0.y)),y0.y,y0.z)
plot3(ones(length(y1.y)),y1.y,y1.z)
xlabel('x')
ylabel('y')
zlabel('z')
  댓글 수: 3
Kevin Holly
Kevin Holly 2022년 2월 22일
x0 = readtable('x0.xlsx');
x1 = readtable('x1.xlsx');
y0 = readtable('y0.xlsx');
y1 = readtable('y1.xlsx');
Colorimage = zeros(max(length(y0.y),length(y1.y)),max(length(x0.x),length(x1.x)));
Colorimage(length(y0.z)-1,:)=x0.z;% made it one off so it displays color
Colorimage(length(y0.z)-100,1:length(x1.x))=x1.z;
Colorimage(:,length(x0.z)-1)=y0.z;% made it one off so it displays color
Colorimage(1:length(y1.y),length(x0.z)-100)=y1.z;
surf(Colorimage)
h=gca;
h.Children.EdgeColor ='none';
h.Children.XData = x0.x;
h.Children.YData = y0.y;
xlabel('x')
ylabel('y')
zlabel('z')
colorbar
figure(2)
Colorimage = zeros(max(length(y0.y),length(y1.y)),max(length(x0.x),length(x1.x)));
Colorimage(length(y0.z)-23,:)=x0.z;% shifted to make visible
Colorimage(length(y0.z)-100,1:length(x1.x))=x1.z;
Colorimage(:,length(x0.z))=y0.z;
Colorimage(1:length(y1.y),length(x0.z)-100)=y1.z;
imagesc(fliplr(Colorimage))
xlabel('x')
ylabel('y')
colorbar
axis off
Kabit Kishore
Kabit Kishore 2022년 2월 22일
Thank you

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by