%% Surface Plot of Mathematical Function
% Plot the function $$ f(x,y) = real(a \tan(x+iy)) $$ over the domain
% $-2\pi < x < 2\pi$ and $-2\pi < y < 2\pi$. The |ezsurf| function does not
% plot points where the mathematical function is not defined. These points
% are set to |NaN| so that they do not plot.

% Copyright 2015 The MathWorks, Inc.


figure
ezsurf('real(atan(x+i*y))')

%%
% Use |surf| to plot the same data without filtering discontinuities.

figure
[x,y] = meshgrid(linspace(-2*pi,2*pi,60));
z = real(atan(x+1i.*y));
surf(x,y,z)