how to create a surf plot for {x, y, z} where z is also a vector, thanks all!
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Sean de Wolski
2012-2-13
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!