

f = inline('x.^2 +2*b*x.*y + y.^2', 'x', 'y', 'b')
disp(' The graph of this function varies from a paraboloid to a ' )
disp('saddle surface as b varies from 0 to 2 in steps of .25  ')
disp(' Hit return to change the value of b  ')
x = linspace (-1,1, 51);
[X,Y] = meshgrid(x,x);

xx = linspace( -1,1, 101);
yy = linspace( -.8, .8, 101);
[XX,YY] = meshgrid(xx,yy);

bb = [0 .25 .5 .75 1 1.25 1.5 2];
for j = 1:8
    b = bb(j)
subplot(2,1,1)
   surf(X,Y,f(X,Y,b))
   axis([-1 1 -1 1  -2,6])
subplot(2,1,2)
   contour(XX,YY, f(XX,YY,b))
pause
end

