Matlab draws circles (rectangle function, viscircles function and parametric equations of circles)

Draw a circle based on matlab

1. rectangle function

For drawing a circle with center coordinates (x, y) and radius r, the function is:

x=0;
y=0;
r=1;
rectangle('Position', [x-r,y-r,2*r,2*r], 'Curvature', [1 1],'EdgeColor', 'r');
axis equal

EdgeColor represents color
Insert image description here

2. viscircles function

Draw a circle with center coordinates (0, 0) and radius r=10

viscircles([0 0],10,'Color','r');%圆心坐标为(20,30),半径为10,轮廓颜色为红色
axis equal

Insert image description here

3. Parametric equations of a circle

r = 10;%半径
a = 0;%圆心横坐标
b = 0;%圆心纵坐标
t=0:0.1:2.1*pi;
x=a+r*cos(t);
y=b+r*sin(t);
plot(x,y,'r','linewidth',4);
axis equal

Insert image description here
linewidth represents line thickness

Guess you like

Origin blog.csdn.net/iii66yy/article/details/132253898