Linear equation of circle

조회 수: 2 (최근 30일)
ANDREAS KOUNTOURIS
ANDREAS KOUNTOURIS 2022년 2월 12일
댓글: ANDREAS KOUNTOURIS 2022년 2월 15일
Hello, consider having a general equation of circle like x^2+y^2=r^2.
A way to linear the circle is to "cut the circle into horizintal or vertical slices". Any idea how could I transfer this idea in matlab equations?
Thank you.
  댓글 수: 6
DGM
DGM 2022년 2월 12일
편집: DGM 2022년 2월 12일
How do you propose to make a circle out of a straight line? Are you asking how to create a polygon? Or to create a series of parallel lines?
Voss
Voss 2022년 2월 12일
Plotting in polar coordinates would allow you to plot a circle while avoiding non-linear terms:
t = 0:0.01:2*pi;
polarplot(t,ones(size(t)),'LineWidth',2);

댓글을 달려면 로그인하십시오.

채택된 답변

DGM
DGM 2022년 2월 12일
편집: DGM 2022년 2월 12일
You mean like this?
r = 1;
y = linspace(-r,r,50);
xr = sqrt(r^2 - y.^2);
xl = -sqrt(r^2 - y.^2);
plot([xr; xl],[y; y])
And I suppose you could rotate it if you wanted
r = 1;
t = 30;
y = linspace(-r,r,50);
xr = sqrt(r^2 - y.^2);
xl = -sqrt(r^2 - y.^2);
[th rh] = cart2pol([xr; xl],[y; y]);
[xx yy] = pol2cart(th+t*pi/180,rh);
plot(xx,yy)
  댓글 수: 1
ANDREAS KOUNTOURIS
ANDREAS KOUNTOURIS 2022년 2월 15일
Yes, something like this. Thank you!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기

제품


릴리스

R2016b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by