Graphing a hyperbola with tangent lines

조회 수: 1 (최근 30일)
mdawg22
mdawg22 2020년 3월 10일
답변: darova 2020년 3월 10일
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

답변 (1개)

darova
darova 2020년 3월 10일
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

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by