How to plot data in an irregular/non orthogonal grid?

64 visualizaciones (últimos 30 días)
Baptiste
Baptiste el 16 de Jul. de 2014
Respondida: Baptiste el 6 de Ag. de 2014
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.

Respuestas (2)

Chris Turnes
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
If you just want to plot the points themselves, and not a surface, you should also consider using scatter3 and stem3.

Baptiste
Baptiste el 6 de Ag. de 2014
Hello,
Thank you for your answer, I'll find a way to recover the intersection instead and try that!
Baptiste

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!

Translated by