x=-2:0.1:2;        % grid points along x-axes         
y=-2:0.1:2;        % grid points along y-axes
%x=-10:0.1:10;        % grid points along x-axes         
%y=-10:0.1:10;        % grid points along y-axes

nx=length(x);       % size of grid along x-axes 
ny=length(y);       % siye of grid along y-axes

%
% evaluate Rosenbrock function in grid points
%

fz=zeros(nx,ny);    % intiliaze matrix size to grid size and set to zero  
for i=1:nx
  for j=1:ny
    fz(i,j) = (1-x(i))^2+105*(y(j)-x(i)^2)^2;
  end
end

%
% make a mesh 
%

figure(1);
hold off;
mesh(x,y,fz');
xlabel('x');             % output 'x' along x axis
ylabel('y');             % output 'y' along y axis
title('a quasiconvex function')

%
% make a contour plot for prespecified contour levels
%

figure(2);               % output next plot on window of figure 1 
hold off;                % overwrite old plot in figure 1
contour(x,y,fz',[1,2,3,4,5,10,20,50,100,200,300,400]);     % plot the function
xlabel('x');             % output 'x' along x axis
ylabel('y');             % output 'y' along y axis
title('a quasiconvex function')
