필터 지우기
필터 지우기

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

조회 수: 2 (최근 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 CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by