%% Create Filled Contour Plot of Mathematical Expression
% This mathematical expression defines a function of two variables, x and y.
% f(x,y) = 3(1-x)^2 e^{-x^2-(y+1)^2} - 10\left(\frac{x}{5} - x^3 - y^5
% \right) e^{-x^2-y^2} - \frac{1}{3}e^{-(x+1)^2-y^2}
% The ezcontourf function requires a function handle argument. Write this mathematical expression in MATLAB syntax as an anonymous function with handle f. You can define an anonymous function in the command window without creating a separate file. For convenience, write the function on three lines.

f = @(x,y) 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);

%
% Pass the function handle, f, to ezcontourf. Specify a domain from -3 to 3 in both the x-direction and y-direction and use a 49-by-49 computational grid.

ezcontourf(f,[-3,3],49)

% In this particular case, the title is too long to fit at the top of the graph, so MATLAB abbreviates it.
% Copyright 2012 The MathWorks, Inc.