Graphing a hyperbola with tangent lines

9 views (last 30 days)
mdawg22
mdawg22 on 10 Mar 2020
Answered: darova on 10 Mar 2020
Hello,
I keep attempting to graph a function of a hyperbola, which is coming out okay.
The issue I am having is that I want to inclue two tangent lines on this hyperbola. I have the x values of each of the tangent lines, but I do not know how to make matlab find the y values for the given x, and then plot them.
Here is my function :
syms x y;
F(x,y) = 2*y-3*x-3*x*y+x^2+y^2-6;
Also I am using fimplicit to plot this hyperbola initially. Is this correct? Can anyone offer insight on how to graph these tangent lines? Ive attempted so many methods in the last 2 days and they all come close, but the tangent lines arent exactly "Tangent looking" For example one or the other lies directly on the curve.
My given x value is 8.9

Answers (1)

darova
darova on 10 Mar 2020
I just exstracted data from ezplot handle
syms x y
F = 2*y-3*x-3*x*y+x^2+y^2-6;
h = ezplot(F,[-1 1]*10);
x1 = get(h(1),'xdata');
x2 = get(h(2),'xdata');
y1 = get(h(1),'ydata');
y2 = get(h(2),'ydata');
hold on
plot([x1(1) x2(1)],[y1(1) y2(1)])
plot([x1(end) x2(end)],[y1(end) y2(end)])
hold off
achievement

Categories

Find more on Just for fun in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!