如何在 meshc 函数中更改网格大小和粒度
How to change size of grid & granularity in meshc function
通过meshc
函数
显示掩码
z = [0 0 0 0;0 1 1 0;0 0 0 0];
meshc(z)
输出为:
期望的输出:
我这边有很多猜测,我猜你想要这样的东西:
%// data
z = [0 0 0 0;0 1 1 0;0 0 0 0];
%// grid
[n,m] = size(z);
[x,y] = ndgrid(1:n,1:m);
%// finer grid
[xq, yq] = ndgrid(linspace(1,n,100),linspace(1,m,100));
%// interpolation
F = griddedInterpolant(x, y, z, 'cubic')
zq = F(xq, yq);
%// interpolated plot
figure(1)
meshc(xq,yq,zq)
通过meshc
函数
z = [0 0 0 0;0 1 1 0;0 0 0 0];
meshc(z)
输出为:
期望的输出:
我这边有很多猜测,我猜你想要这样的东西:
%// data
z = [0 0 0 0;0 1 1 0;0 0 0 0];
%// grid
[n,m] = size(z);
[x,y] = ndgrid(1:n,1:m);
%// finer grid
[xq, yq] = ndgrid(linspace(1,n,100),linspace(1,m,100));
%// interpolation
F = griddedInterpolant(x, y, z, 'cubic')
zq = F(xq, yq);
%// interpolated plot
figure(1)
meshc(xq,yq,zq)