%% Contours at Fifty Levels
% Define Z as a function of two variables, X and Y. Then plot the contours of Z. In this case, let MATLAB® choose the contours and the limits for the x- and y-axes.

[X,Y] = meshgrid(-5:0.25:5);
Z = X.^2 + Y.^2;
contour3(Z)

%
% Now specify 50 contour levels, and display the results within the x and y limits used to calculate Z.

contour3(X,Y,Z,50)

% Copyright 2018 The MathWorks, Inc.