How to plot circles in polar form?

4 次查看(过去 30 天)
Hannah Beezie
Hannah Beezie 2022-3-25
编辑: Voss 2022-3-25
I am attempting to plot the orbits of the planets in polar form using matricies holding the relevant values.
When attempting to use the polarplot() function, the resulting graph does not produce any circles/ellipses, only a few connected line segments.
What might I have done incorrectly in attempting to graph these orbits?
Please DO NOT suggest any changes that use a non-vectorized method.
My current code (reduced to only 4 planets for demonstration):
p = [.387 .723 1 1.524];
E = [.2056 .0068 .0167 .0934];
theta = deg2rad([7.005 3.3947 0 1.851]);
radius = p./(1.- (E.*cos(theta)));
polarplot(theta, radius);
  2 个评论
Voss
Voss 2022-3-25
编辑:Voss 2022-3-25
You've only got four points there, when you need four orbits, right?
I don't know enough about equations for elliptical orbits to know where your theta are supposed to fit in, but I know that you'll have to specify points all the way around the orbit:
p = [.387 .723 1 1.524];
E = [.2056 .0068 .0167 .0934];
% theta = deg2rad([7.005 3.3947 0 1.851]);
theta = linspace(0,2*pi,100).';
radius = p./(1 + (E.*cos(theta)));
polarplot(theta, radius,'LineWidth',2);
That gives you some orbits; maybe you can work with it to get what you're going for.
Hannah Beezie
Hannah Beezie 2022-3-25
Thank you so much! That certainly looks more like the result I was aiming for.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Earth and Planetary Science 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by