考虑以下情节:
在左侧,您可以使用patch
命令查看相对于函数轮廓的圆的填充
t = linspace(-pi,pi,100);
c = exp(-cos(t));
figure(1)
patch(cos(t),sin(t),c)
axis equal
在右侧,您可以看到左侧虚线轴上的功能配置文件,使用area
命令填充该配置文件。
figure(2)
area(cos(t),c,0);
我能想出的最接近的是:
function q55322965
% Evaluate the equation (half domain!)
t = linspace(-pi,0,50);
c = exp(-cos(t));
% Turn vectors into a mesh:
[TT,CC] = meshgrid(cos(t),c);
% Clear all points that are above the curve:
CC(CC > c) = NaN;
% Fill in the rectangle between the chart and zero:
CC(end+1,:) = 0;
TT(end+1,:) = TT(end,:);
% Plot:
figure(); mesh(TT,CC,CC,'FaceColor','interp','EdgeColor','interp'); view([0,90]);
产量:
如果您在使用此方法绘图时想要较少的锯齿状外观,则可以在t
中增加分辨率。例如,如果我们在500
中使用50
而不是linspace
,我们得到: