![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175354/image.png)
How to plot data in an irregular/non orthogonal grid?
37 ビュー (過去 30 日間)
古いコメントを表示
Hi everybody!
I am struggling for a couple a days on an issue. I have an irregular and non-orthogonal grid (see image attached) characterized by the x and y vectors giving the position of the middle of each mesh and the data(x,y). Is there a function, a way, or a magic trick that would allow me to plot my data on this non-rectangular shaped grid?
Thanks a lot,
B.
0 件のコメント
回答 (2 件)
Chris Turnes
2014 年 8 月 5 日
The mesh and surf functions can take irregularly spaced vector and matrix inputs that define the mesh. However, their inputs are the intersections of the grid lines, rather than the center of each cell of the mesh (see the documentation for mesh and the documentation for surf for more details).
As a small example, if I have an irregular mesh whose vertices are given by
>> x = [0.1, 0.4, 1.0, 2.2; ...
0.1, 0.3, 0.7, 1.5; ...
0.1, 0.2, 0.4, 0.8; ...
0.1, 0.15, 0.25, 0.45];
>> y = (0.1:0.3:1)'*ones(1,4)
and corresponding value data
>> z = [0.1; 0.5; 0.5; 0.1]*[0.1, 0.3, 0.5, 0.3];
I can use mesh to plot the data on this irregular grid
>> mesh(x, y, z)
to produce the plot
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175354/image.png)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!