disp('  ')
disp('  Partial Derivatives seen by slices parallel to the x axis ')
disp('   and slices parallel to the y axis  ')
disp(' ')
disp('  You will see the graph of the function ')
disp('    f(x,y) =  |x|y ' )
disp(' ')
disp('   After you have enlarged the figure window, hit return and' )
disp('   a lower figure window will open with a contour map of the')
disp('   function . You can click 4 times on the lower window to locate')
disp(' where you want to see slices through the graph ')



f = inline('abs(x).*y', 'x', 'y');
x = linspace(-2,2,51);
y = x;
[X,Y] = meshgrid(x,y);

subplot(2,1,1)
   surf(X,Y,f(X,Y)); shading interp; colormap(gray);
   hold on
   plot3([0 0], [-2,2], [0,0], 'k')
   axis([-2 2 -2 2 -5 5])
disp(' Rotate the figure, enlarge the figure window ')
pause
disp(' ')
disp('  Now you can click 4  times in lower window  ')


subplot(2,1,2)
   contour(X,Y,f(X,Y))
   hold on
   plot([0 0], [-2 2], 'k')
subplot(2,1,2)
   [p1,p2] = ginput(1);
   plot(p1,p2, '*')
subplot(2,1,1)
   hx = xslice(f,x,p2);
   hy = yslice(f,p1,y);
   
for j = 1:3  
    subplot(2,1,2)
        [p1,p2] = ginput(1); 
        plot( p1, p2 ,'*')

    subplot(2,1,1)
        delete(hx); delete(hy) 
        hx = xslice(f,x,p2);
        hy = yslice(f,p1,y); 
end
pause
close
    
    
