% TestPeaks.m L Braile 3/18/05 % Show the 'Peaks' function; from the Matlab Help, % Mesh command. % The peaks function is: % z = 3*(1-x).^2.*exp(-(x.^2) - (y+1).^2) ... % - 10*(x/5 - x.^3 - y.^5).*exp(-x.^2-y.^2) ... % - 1/3*exp(-(x+1).^2 - y.^2); % It is convenient to view over an x,y space of % -3 to +3 with an interval (dx = dy) of about % 0.05 to 0.2 % Peaks can also be viewed with plot3, surf, pcolor, etc. [X,Y] = meshgrid(-3:.125:3); Z = peaks(X,Y); meshc(X,Y,Z); axis([-3 3 -3 3 -10 5])