% bumps.m
%
% script file illustrating the following:
% meshgrid() function
% 
%-------------------------------------------------------------------------------
% Meshgrid for 3-D plot
%-------------------------------------------------------------------------------
% Create the x,y pts for plotting the gaussian bumps
spacing = 0.4;
x = -4:spacing:4;   % Create array of x values for grid of (x,y) pts.
y =  0:spacing:8;   % Create array of y values for grid of (x,y) pts.

[xx,yy] = meshgrid(x,y);

%-------------------------------------------------------------------------------
% Array Processing
%-------------------------------------------------------------------------------
% Sum up gaussian-shaped, (i.e., e^(-x^2)), bumps to create desired surface.
% Hill located at (2,5).
z = exp(-(((2-xx).^2) + (5-yy).^2));

% Bump located at (-1, 2), spread out slightly.
z = z + exp(-((-1-xx).^2 + (2-yy).^2)/(3^2));

%-------------------------------------------------------------------------------
% 3-D Surface and Contour Plots
%-------------------------------------------------------------------------------
% To make lit surface plot use:
figure(1)
surfl(xx,yy,z)
shading interp
colormap('autumn')
% Change azimuth to 37.5 degrees, elevation 60 degrees.
view(-37.5,60)

% To make contour plot use:
figure(2)
contour(xx,yy,z)

