![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/175354/image.png)
How to plot data in an irregular/non orthogonal grid?
32 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (2)
Chris Turnes
el 5 de Ag. de 2014
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 comentarios
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!