% Plotting complex phase using HSV and |z| height
clear
% Enter function
fn = @(x) x;
%fn = @(x) x.^2;
%fn = @(x) exp(x);
%fn = @(x) 1./(x.*(1-x));
xmin=-2;
xmax=2;
ymin=-2;
ymax=2;
Nx=500;
Ny=500;
x=linspace(xmin,xmax,Nx);
y=linspace(ymin,ymax,Ny);
[X,Y] = meshgrid(x,y);
z = complex(X, Y);
Z = fn(z);
P=atan2(imag(Z),real(Z));
figure(1)
surf(X,Y,abs(Z),P)
view(2)
colormap hsv
shading interp
axis square
figure(2)
surf(X,Y,abs(Z),P)
colormap hsv
%shading flat
shading interp
axis square