How I plot parametric ellipse ,, tangenten and perpendicular.?

4 ビュー (過去 30 日間)
Colly Lau
Colly Lau 2016 年 9 月 7 日
コメント済み: Ramesh Bala 2018 年 7 月 27 日
1)Give ellipse (x-1)^2+y^2/4=1 after some calculation I got x= cost +1 y= 2sint (parametric equations)
2)Find a unit tangent vector, parametric equations of the tangent and perpendicular in point (1, 2). after some calculation I got unit tangent vector (1,2) tangent (0,-2) perpendicular (1,0)
I got the matlab code from lecture but I try to changes the equations to mine but is not work.
close all % Approximation of an ellipse (parametrized!) (x/2)^2+(y/3)^2=1. for i=5:10 % define the parameter t t = 0:2*pi/i:2*pi; % plot parametric curve plot(sqrt(cos(t)+1)), sqrt(2)*sin(t); axis equal; xlim([-2,2]); ylim([-2,2]); % set a grid on the plot grid on; title(sprintf('Approximation of the ellipse (x/2)^2+(y/3)^2=1 with i = %i', i)); pause(1); end
If somebody have better and easier solution please give me advice..
thank you!
  1 件のコメント
Ramesh Bala
Ramesh Bala 2018 年 7 月 26 日
%parametric form
t = linspace(0, 2*pi, 200);
xt = r1 * cos(t) + xc; yt = r2 * sin(t) + yc;
% aply rotation by angle theta
cot = cos(theta); sit = sin(theta);
x = xt * cot - yt * sit;
y = xt * sit - yt * cot;
plot(x, y, '-');

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

回答 (1 件)

Ajey Pandey
Ajey Pandey 2018 年 7 月 26 日
To piggyback off Kaleesh's comment, the documentation for plot offers a tutorial for plotting parametric equations.
Look for the "Plot Circle" example.
  1 件のコメント
Ramesh Bala
Ramesh Bala 2018 年 7 月 27 日
yeah thanks in circle case it's same radii and axis equal.In ellipse r varies.So,if one knows r1 ,using formulation can get r2.
So any idea to get r1 from foci?

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by