MATLAB Answers

0

Finding the tangent line of an ellipse

Asked by Destin Davis on 10 Jun 2019
Latest activity Commented on by darova
on 10 Jun 2019
I have to find the tangent line of an ellipse that I have written code for. The ellipse is parametrized, so I'm not sure how to write the code to find the tangent line. This is waht I have so far. What do you recommend I add to find the tangent line at the point (x(a),y(a))? Please respond as soon as possible.
function destin_ellipse(xRadius,yRadius)
c=sqrt(xRadius^2-yRadius^2);
theta = [0 : 0.01 : 2*pi]';
x = xRadius * cos(theta);
y = yRadius * sin(theta);
a=randi(300);
clf;
plot(x, y, 'LineWidth', 1);
hold on;
plot(x(a),y(a),'r.');
plot([-c x(a)],[0 y(a)],'g');
plot([c x(a)],[0 y(a)],'g');
plot(c,0,'r.');
plot(-c,0,'r.');
axis square;
grid on;
if xRadius>yRadius
xlim([-(xRadius+1), xRadius+1]); ylim([-(xRadius+1), xRadius+1])
else
xlim([-(xRadius+1), xRadius+1]);
ylim([-(yRadius+1), yRadius+1]);
end

  0 Comments

Sign in to comment.

Products


Release

R2018a

1 Answer

Answer by KSSV
on 10 Jun 2019

  4 Comments

Show 1 older comment
Since tangens of an angle:
Thank you so much. But with this derivative, how would I plot the tangent line at my point (x(a),y(a))?
What do you know about equation of a straight line?

Sign in to comment.