Using the ellipse graph.

6 ビュー (過去 30 日間)
John Lutz
John Lutz 2017 年 9 月 30 日
回答済み: Ali Nafar 2019 年 6 月 13 日
In polar coordinates (r,t), the equation of an ellipse with one of its foci at the origin is r(t) = a(1 - e2)/(1 - (e)cos(t)) I'm confused how to set this up, as I have never occurred an ellipse graph before. where a is the size of the semi-major axis (along the x-axis) and e is the eccentricity. Plot ellipses using this formula, ensuring that the curves are smooth by selecting an appropriate number of points in the angular (t) coordinate Thank you.
function untitled3
a = 1/2(b);
e = 0.5;
t = linspace(0,2*pi);
r = a(1 - e.^2)./(1 - (e)*cos(t));
plot(r,t)
axis equal
end

回答 (3 件)

Image Analyst
Image Analyst 2017 年 9 月 30 日
You need to define b using a and e, not assume b is already defined like you did.
  1 件のコメント
John Lutz
John Lutz 2017 年 9 月 30 日
Still does not work, really confused on this.
t = linspace(0,2*pi);
e = 2*pi;
a = 1/2.*(2*pi);
r = (a.*(1 - e.^2) ./ (1 - ((e)*cos(t))));
axis equal
plot(r,t);
also this doesn't work either, tried many times to get this to work but it doesn't.

サインインしてコメントする。


Henry Giddens
Henry Giddens 2017 年 9 月 30 日
Your equation ends up with some negative values - (which I'm not sure can be correct?), but if you are using polar coordinates, then use the polarplot or polar commands:
polarplot(t,abs(r))

Ali Nafar
Ali Nafar 2019 年 6 月 13 日
L=0.5;
e=0.5;
phi0=0;
phi=linspace(0,2*pi);
rho=L*(1-e^2)./(1-e*cos(phi-phi0));
polar(phi,rho)

カテゴリ

Help Center および File ExchangePolar Plots についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by