%%% graphics for math 23a, UCSC W2004
% cf matlab help for contour, meshgrid
% first, get matrix X of rows x, matrix Y of columns y
x = [-2:.2:2]; % xmin:xstep:xmax
y = [-2:.2:2]; % ditto for y
[X,Y] = meshgrid(x,y);
% now define the matrix of z values over the meshgrid
% for the function x*exp(-r^2) for example
Z = X.*exp(-X.^2-Y.^2);
% and now choose 4 styles of plot
% contour(X,Y,Z,20)
contour3(X,Y,Z,20)
% mesh(X,Y,Z)
% surf(X,Y,Z)
% in last three cases, may add a section like this
hold on
plot3(X(10,:), Y(10,:), Z(10,:))
hold off