function my_cplxroot(n,m)
%MY_CPLXROOT Riemann surface for the n-th root.
%   MY_CPLXROOT(n) renders the Riemann surface for the n-th root.
%   MY_CPLXROOT, by itself, renders the Riemann surface for the cube root.
%   MY_CPLXROOT(n,m) uses an m-by-m grid.  Default m = 20.

%   C. B. Moler, 8-17-89, 7-20-91.
%   Copyright (c) 1984-98 by The MathWorks, Inc.
%   $Revision: 5.3 $  $Date: 1997/11/21 23:25:27 $
% RCS: Modified for our use Oct. 10, 2000

% Use polar coordinates, (r,theta).
% Cover the unit disc n times.

if nargin < 1, n = 3; end
if nargin < 2, m = 20; end
r = (0:m)'/m;
theta = pi*(-n*m:n*m)/m;
z = r * exp(i*theta);
s = r.^(1/n) * exp(i*theta/n);
figure
surf(real(z),imag(z),real(s),imag(s));
%surf(real(z),imag(z),abs(s),imag(s));
colormap hsv
shading interp
axis square