
%%% management functions
clear  % clear all variable/information in the workspace - use CAUTION
clear global  %  again use caution - clears global information
clc    % position the cursor at the top of the screen
close   %  closes the figure window
format compact  % avoid skipping a line when writing to the command window
warning off  %#ok<WNOFF> % don't report any warnings like divide by zero etc.


x1 = linspace(-3,15,101);
x2 = linspace(-3,5,101);
[X1 X2]=meshgrid(x1,x2);
a = 10; b = 1;
fun = (1 + a -b*X1 - b*X2).^2 + ...
    (b + X1 + a*X2 -b*X1.*X2).^2;

colormap(summer)
cval = [10 20 150 100 500 1000 2000 5000];
[c1 h1] = contourf(x1,x2,fun,[41 45 50 60 100 150 500 1000]);
clabel(c1)
%surf(X1,X2,fun)
colorbar
grid
xlabel('x_1');
ylabel('x_2');
title('Example 6.4')