开发者

Mesh plot when X and Y values are not on a grid

Is it possible to cre开发者_C百科ate a mesh plot from X, Y, and Z when X and Y do not form a grid?


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜