How to plot the surface of multiple data sets ?

6 次查看(过去 30 天)
I have three different data sets each being constant in the z/l axis and want to plot the surface of them. I got the 3d plot working using plot3() :
All three lines have the same amount of data points so it should not be that hard to connect each point of each line with a straight line.
Here's the code for the figure:
figure(35);
set(gcf,'position',[x0,y0,width,height])
plot3(porous_upper(pathnumber_10,1).values(:,xc_x)*scale_x,porous_upper(pathnumber_10,1).values(:,xc_x+2)*scale_z,porous_upper(pathnumber_10,1).values(:,yc_x),"DisplayName","Porous Upper 1 p -10");
hold on;
plot3(porous_upper(pathnumber_10,2).values(:,xc_x)*scale_x,porous_upper(pathnumber_10,2).values(:,xc_x+2)*scale_z,porous_upper(pathnumber_10,2).values(:,yc_x),"DisplayName","Porous Upper 2 p -10");
hold on;
plot3(porous_upper(pathnumber_10,3).values(:,xc_x)*scale_x,porous_upper(pathnumber_10,3).values(:,xc_x+2)*scale_z,porous_upper(pathnumber_10,3).values(:,yc_x),"DisplayName","Porous Upper 3 p -10");
title(["Pressure p above porous layer";"Sidecoefficent Test -10"],'interpreter','latex',"FontSize",20)
set(gca, 'YDir','reverse')
xlabel('X/L', 'Interpreter','latex',"FontSize",16);
ylabel('Z/L', 'Interpreter','latex',"FontSize",20);
zlabel('$p$', 'Interpreter','latex',"FontSize",20);
legend("show","Location","Best","AutoUpdate", "off");

采纳的回答

Star Strider
Star Strider 2021-8-20
It would help to have the actual data.
N = 20;
X = (0:N-1);
Y = [1:3].'+zeros(size(X));
porous_upper = rand(20,3)+[0:2];
figure
plot3(X, Y(1,:), porous_upper(:,1))
hold on
plot3(X, Y(2,:), porous_upper(:,2))
plot3(X, Y(3,:), porous_upper(:,3))
hold off
grid on
figure
surf(porous_upper.')
Make appropriate changes to work with your data.
.
  6 个评论

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by