how to create a surf plot for {x, y, z} where z is also a vector, thanks all!
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi all, my problems are This is a simple mesh with four points 1,2 3 and 4, whose coordination are (x1, y1),...,(x4, y4), now i have the coordination values at X axis and y
node_x=[x1, x2, x3, x4]; node_y=[y1, y2, y3, y4]; and the z value for each point as
node_z=[z1, z2, z3, z4];
4--------------------3
| |
| |
| |
| |
| |
| |
| |
| |
| |
1--------------------2
I have to get a surf plot of these mesh points, however, my z values are not a matrix but a vector, do any body know how to create this surf plot?
For this matlab code as
clear clc node_x=[0, 20, 20, 0]; node_y=[0, 0, 20, 20]; node_z=[0.4, 0.4, 0.3, 0.3]
Thanks a lot.
0 comentarios
Respuesta aceptada
Sean de Wolski
el 13 de Feb. de 2012
You need to have points as 2d matrices in order to use mesh or surf. Look into meshgrid and interp2 to get your points onto a grid. For simples cases like this, you might prefer to just call patch directly.
node_x=[0, 20 20, 0];
node_y=[0, 0 20, 20];
node_z=[0.4, 0.4 0.3, 0.3];
patch(node_x,node_y,node_z,node_z)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Surface and Mesh Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!