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

2 ビュー (過去 30 日間)
David Zhang
David Zhang 2012 年 2 月 13 日
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 Center および File ExchangePolygons についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by