how to create a surf plot for {x, y, z} where z is also a vector, thanks all!

4 次查看(过去 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.

采纳的回答

Sean de Wolski
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 个)

类别

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