You are on page 1of 2

Question ; Plot the tangent line for the equation f=x^2+x*y-y^2-1 at the point (x,y)=(2,3)

Code ;

clc

clear all

close all

syms x y x_t y_t

f=x^2+x*y-y^2-1;

x1=2;y1=3;

figure(1)

h1=plot(x1,y1,'*','Markersize',16);

set(h1,'color','r')

hold on

h2=ezplot(f);

set(h2,'color','k')

hold on

dydx=-diff(f,x)/diff(f,y);

m=subs(dydx,[x,y],[2,3]);

y_t=m*(x_t-x1)+y1;

h3=ezplot(y_t);

set(h3,'color','g')

hold off

Output ;
Graph ;

You might also like