Is it possible to create a mesh plot from X, Y, and Z when X and Y do not form a grid?
Asked
Active
Viewed 360 times
0
-
4This is effectively the same as your [last question](http://stackoverflow.com/questions/3939265/contour-plot-when-x-and-y-values-are-not-on-a-grid), and has also been covered in this other question (in which the non-uniform points are drawn from isolines): [How Do I Generate a 3-D Surface From Isolines?](http://stackoverflow.com/questions/1672176/how-do-i-generate-a-3-d-surface-from-isolines) – gnovice Oct 15 '10 at 03:42
-
3And here's another question that should help too: [How do I make a surf plot in MATLAB with irregularly spaced data?](http://stackoverflow.com/questions/2848015/how-do-i-make-a-surf-plot-in-matlab-with-irregularly-spaced-data) – gnovice Oct 15 '10 at 03:54
1 Answers
0
The example below might answer your question
clear all
close all
xdata = [1:11];
ydata = [1:6 1:5];
zdata = rand(size(xdata));
[X,Y] = meshgrid(linspace(min(xdata),max(xdata),20), linspace(min(ydata),max(ydata),30));
Y=sort(Y,'descend');
X=sort(X,'descend');
contourdata = griddata(xdata,ydata,zdata,X,Y);
figure
%contourf(X,Y,contourdata,30,'LineColor','None');
mesh(X,Y,contourdata);
colorbar

horseshoe
- 1,437
- 14
- 42