📜  MATLAB 2D fill()

📅  最后修改于: 2021-01-07 02:35:10             🧑  作者: Mango

MATLAB fill()

为了绘制填充的多边形,我们可以使用fill()函数。记录顶点以及要填充的颜色。

句法

fill(x,y,)    // It creates filled polygons from the data specified by x and y with color c.
fill(x1,y1,c1....xN,yN,cN)    // It specifies multiple 2-D filled areas
fill(x,y,colorspec)    // It fills 2-D polygons specified by X and Y with the color specified by colorspec.

r^2=2sin5t,0≤t≤2π
x=r cost,y=r sint
t=linspace (0, 2*pi,200);
r=sqrt(abs(2*sin(5*t)));
x=r.*cos(t);
y=r.*sin(t);
fill(x, y, 'k');
axis('square')

输出: