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
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
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
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?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!