how to draw a regular polygon with polarplot command?
8 次查看(过去 30 天)
显示 更早的评论
how to draw a regular polygon with polarplot command?
i'll use input command for n and R.
(n is the number of vertices, R is the distance between the vertex and the center)
conditions are
- center is 0,0
- the distance between vertex and center is R.
3 个评论
采纳的回答
KSSV
2022-12-16
Convert polar coordinates to cartesian and then plot.
prompt_n=('Input n what you want(n>=3): ');
prompt_R=('Input R what you want(R>0): ');
na=input(prompt_n);
R=input(prompt_R);
n=round(na);
theta = 0:pi/90:2*pi;
pgon = nsidedpoly(n,'Center',[0,0]);
x = R*cos(theta) ;
y = R*sin(theta) ;
if n>3
plot(pgon)
hold on
plot(x,y)
else
disp('끝냅시닷:p');
end
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Cartesian Coordinate System Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!