home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 3.ddi / DEMOS.DI$ / CPLXROOT.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  608 b   |  21 lines

  1. function cplxroot(n,m)
  2. %CPLXROOT Riemann surface for the n-th root.
  3. %    CPLXROOT(n) renders the Riemann surface for the n-th root.
  4. %    CPLXROOT, by itself, renders the Riemann surface for the cube root.
  5. %    CPLXROOT(n,m) uses an m-by-m grid.  Default m = 20.
  6.  
  7. %    C. B. Moler, 8-17-89, 7-20-91.
  8. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  9.  
  10. % Use polar coordinates, (r,theta).
  11. % Cover the unit disc n times.
  12.  
  13. if nargin < 1, n = 3; end
  14. if nargin < 2, m = 20; end
  15. r = (0:m)'/m;
  16. theta = pi*(-n*m:n*m)/m;
  17. z = r * exp(i*theta);
  18. s = r.^(1/n) * exp(i*theta/n);
  19.  
  20. surf(real(z),imag(z),real(s),imag(s));
  21.