Plotting the modulus, real, and imag parts of a complex valued function

First set up the complex valued function to plot.

f = @(z) sqrt(z);

Next setup the grid to evaluate the function.

x = linspace(-3,3,601);
y = linspace(-3,3,601);
[xx,yy] = meshgrid(x,y);

Evaluate the function and get the real and imaginary parts.

ff = f(xx+1i*yy);
uu = real(ff);
vv = imag(ff);

Plot the results.

figure(1);
clf;
surf(xx,yy,abs(ff));
shading interp, alpha(0.85);
xlabel('Re(z)'), ylabel('Im(z)');
title('|f(z)|')
box on;
axis tight;

figure(2);
clf;
surf(xx,yy,uu); hold on;
contour3(xx,yy,uu,25,'k-');
hold off;
shading interp, alpha(0.85);
xlabel('Re(z)'), ylabel('Im(z)');
title('Re(f(z))')
box on;
axis tight;

figure(3);
clf;
surf(xx,yy,vv); hold on;
contour3(xx,yy,vv,25,'k-');
hold off;
shading interp, alpha(0.85);
xlabel('Re(z)'), ylabel('Im(z)');
title('Im(f(z))')
box on;
axis tight;