home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / SPECFUN.DI$ / CART2SPH.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  497 b   |  15 lines

  1. function [az,elev,r] = cart2sph(x,y,z)
  2. %CART2SPH Transform Cartesian coordinates to spherical.
  3. %    [AZ,EL,R] = CART2SPH(X,Y,Z) transforms data stored in Cartesian
  4. %    coordinates to spherical coordinates. If [M,N] = SIZE(X), then
  5. %    Y and Z must be also be the same size.  AZ and EL are in radians.
  6. %
  7. %    See also CART2POL, SPH2CART, POL2CART.
  8.  
  9. %    L. Shure, 4-20-92.
  10. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  11.  
  12. r = sqrt(x.^2+y.^2+z.^2);
  13. elev = atan2(z,sqrt(x.^2+y.^2));
  14. az = atan2(y,x);
  15.