how to plot a matrix values in 3d plot
x=[0.2:0.5:0.8:1:1.5]
y=[0:0.2:0.4:0.6:0.8]
I got the matrix z=matrix(5x5) values from excel and each values correspond to x and y.

 Réponse acceptée

It would be nice to have the ‘z’ matrix as well, however in its absence, I will create one.
x=[0.2;0.5;0.8;1;1.5];
y=[0;0.2;0.4;0.6;0.8];
z = x*y.';;
figure
surf(x, y, z)
grid on
xlabel('x')
ylabel('y')
Use semicolons (;) not colons (:) to do vertical concatenation. They are two entirely different operators, and are used for entirely different purpoases.
.

4 commentaires

thanks for your reply, I'll explain you what I want to get and I will thankful if you could help me
as you can see in the table all values are for each x and y, I got them in from excel. and for each x=0.2 x=0.5 x=0.8 x=1 x=1.5 I have the corresponding valuse of y=0 y=0,2 y=0,4 y=0,6 y=0,8 .
i need to plot those result as 3d graph
X=0.2 0.5 0.8 1 1.5 and Y=0 0.2 0.4 0.6 0.8 and Z is the values in the table
i tried to make this matriz but i doesnt work
z =[0.3330 0.3331 0.3331 0.3330 0.3331;
0.2680 0.2683 0.2683 0.2683 0.2683;
0.2011 0.2012 0.2012 0.2011 0.2011;
0.1333 0.1334 0.1336 0.1335 0.1335;
0.0669 0.0672 0.0671 0.0672 0.0671];
It works for me.
Try this —
x=[0.2;0.5;0.8;1;1.5];
y=[0;0.2;0.4;0.6;0.8];
z =[0.3330 0.3331 0.3331 0.3330 0.3331;
0.2680 0.2683 0.2683 0.2683 0.2683;
0.2011 0.2012 0.2012 0.2011 0.2011;
0.1333 0.1334 0.1336 0.1335 0.1335;
0.0669 0.0672 0.0671 0.0672 0.0671];
figure
surf(x, y, z)
grid on
xlabel('x')
ylabel('y')
view(75,30)
What else do you wnat it to do?
.
thank you so much,
I got it, I will see if I need someting else I will contact you.
Star Strider
Star Strider le 26 Sep 2021
As always, my pleasure!
I will do my best to provied useful solutions.
.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by