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

8 Ansichten (letzte 30 Tage)
Colly Lau
Colly Lau am 7 Sep. 2016
Kommentiert: Ramesh Bala am 27 Jul. 2018
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 Kommentar
Ramesh Bala
Ramesh Bala am 26 Jul. 2018
%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, '-');

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Ajey Pandey
Ajey Pandey am 26 Jul. 2018
To piggyback off Kaleesh's comment, the documentation for plot offers a tutorial for plotting parametric equations.
Look for the "Plot Circle" example.
  1 Kommentar
Ramesh Bala
Ramesh Bala am 27 Jul. 2018
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?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by