MATLAB Week- 6
MATLAB Partial Derivatives Week: 6 clear all clc syms x y z= input( 'enter the function' ) x1= input( 'enter the x value' ) y1=input( 'enter the value of y' ) z1 = subs(subs(z,x,x1),y,y1) ezsurf(z,[x1-2,x1+2]) f1=diff(z,x) slope x =subs(subs(f1,x,x1),y,y1) [x2,z2]=meshgrid(x1-2:25:x1+2 ,0:0.5:10) y2=y1*ones(size(x2)) hold on surf(x2,y2,z2) t=linspace(-1,1) x3=x1+t y3=y1*ones(size(t)) z3=z1+ slopex*t; line(x3,y3,z3, 'color' , 'blue' , 'line width' ,2) Question 1) f(x)= x^2 - 2*y^2 Question 2) f(x)=x^3+y^3+6*x*y-1 at (1,1) Question 3) f(x)= 4-x^2-2*y^2 at (1,1)