How to plot data in an irregular/non orthogonal grid?
59 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Chris Turnes
am 5 Aug. 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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!