%% Plot Four-Quadrant Inverse Tangent
% Plot atan2(Y,X) for -4<Y<4 and -4<X<4.
%
% Define the interval to plot over.

[X,Y] = meshgrid(-4:0.1:4,-4:0.1:4);

%
% Find atan2(Y,X) over the interval.

P = atan2(Y,X);

%
% Use surf to generate a surface plot of the function. Note that plot plots the discontinuity that exists at Y=0 for all X<0.

surf(X,Y,P);
view(45,45);

% Copyright 2012 The MathWorks, Inc.