之前只用过peaks函数构造三维图形,不太清楚这种三维图要如何绘制,希望能得到指点
如这个图所示,感谢!
之前只用过peaks函数构造三维图形,不太清楚这种三维图要如何绘制,希望能得到指点
[x,y] = meshgrid(0:1:400);
f = @(x,y,h,r) -h/r*sqrt((x-rand(1)*300-50).^2+(y-rand(1)*300-50).^2)+h;
f0 = zeros(size(x));
for i = 1:6
h = rand()*50+100;
r = rand()*20+10;
fm = f(x,y,h,r);
fm(fm<0) = 0;
f0 = f0 + fm;
end
f0(f0<0)=0;
mesh(x,y,f0)