%% ================================================================
% Monkey saddle with graph coordinates.
% z = x^3 - 3xy^2
% ----------------------------------------------------------------
% John Kerl
% Math 537A
% 2007-11-27
% ----------------------------------------------------------------

function [x, y, z, ds, dt] = monkeysetup()
smin = -4.0;
smax =  4.0;
ns   = 64;
ds   = (smax-smin)/ns;

% t sweeps down from the north pole.
tmin = -4.0;
tmax =  4.0;
nt   = 64;
dt   = (tmax-tmin)/nt;

[s,t] = meshgrid(smin:ds:smax, tmin:dt:tmax);

%% Apply the parameterization to obtain R^3 coordinates
x  = s;
y  = t;
z  = s.^3 - 3.0 * s .* t.^2;
