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

3 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by