clear
close all

disp('              Partial Derivatives  ')
disp('  ')
disp(' Here is the graph of f(x,y) = (3y-y^3)/(1+x^2)   ')

 f = inline('-(y.^3-3*y)./(1+x.^2)', 'x', 'y');

 clear x y
 x = linspace( -2,2, 51);
 y = linspace( -1.5, 1.5, 51);
 [X,Y] = meshgrid(x,y);

 surf(X,Y,f(X,Y)); colormap(gray); shading interp;
 axis([ -2 2 -1.5 1.5 -2 2])
 xlabel('\fontsize{14}x  ')
 ylabel('\fontsize{14}y ')
 hold on
 disp(' ')
 disp(' Slices parallel to the x axis at y = -1, y =0 and y = 1')
 pause
 xslice(f, x, -1);
 rotate3d on
 pause
 xslice(f, x, 0);
 pause 
 xslice(f,x,1);
 hold off
 rotate3d on
 pause

 disp(' ')
 disp(' Slices parallel to the y axis at x = -1, x=0 and x = 1')
 figure
 surf(X,Y,f(X,Y)); colormap(gray); shading interp;
 axis([-2 2 -1.5 1.4 -2 2])
 xlabel('\fontsize{14} x')
 ylabel('\fontsize{14} y')
 hold on
 pause
 yslice(f, 1,y);
 pause
 yslice(f, 0,y);
 pause
 yslice(f, -1,y);
 hold off
 pause
 rotate3d on
 close all
 
