How to plot the surface of multiple data sets ?

6 Ansichten (letzte 30 Tage)
Jean Volkmar
Jean Volkmar am 20 Aug. 2021
Kommentiert: Star Strider am 20 Aug. 2021
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");

Akzeptierte Antwort

Star Strider
Star Strider am 20 Aug. 2021
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 Kommentare
Jean Volkmar
Jean Volkmar am 20 Aug. 2021
Alright thanks alot ! :)
Star Strider
Star Strider am 20 Aug. 2021
As always, my pleasure!
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by