% ### EXcreate3D.m ###      11.04.16

% code to demonstrate/fiddle w/ 3-D plots in Matlab

% Notes
% o once you make the plot, in the figure window, look up top for the icon
% that is a cube w/ a circular arrow around it ("Rotate 3D"). Click on that
% and then have some fun....
% o type "help peaks" to see where/how the multivariable function (i.e., z)
% is generated

clear
% -----------
N= 25;          % # of axis points in xy-plane
M= 20;          % # of lines for contour plot
% -----------

% ====
% surface plot
[X,Y,Z] = peaks(N);     % use built-in Matlab function to create "z"
figure(1); clf;
surf(X,Y,Z);    h= colorbar;
xlabel('x'); ylabel('y'); zlabel('z'); ylabel(h,'z');

% ====
% contour plot
figure(2); clf;
contour(X,Y,Z,M,'LineWidth',2);    h= colorbar; grid on;
xlabel('x'); ylabel('y'); zlabel('z'); ylabel(h,'z');