home *** CD-ROM | disk | FTP | other *** search
- function [az,elev,r] = cart2sph(x,y,z)
- %CART2SPH Transform Cartesian coordinates to spherical.
- % [AZ,EL,R] = CART2SPH(X,Y,Z) transforms data stored in Cartesian
- % coordinates to spherical coordinates. If [M,N] = SIZE(X), then
- % Y and Z must be also be the same size. AZ and EL are in radians.
- %
- % See also CART2POL, SPH2CART, POL2CART.
-
- % L. Shure, 4-20-92.
- % Copyright (c) 1984-93 by The MathWorks, Inc.
-
- r = sqrt(x.^2+y.^2+z.^2);
- elev = atan2(z,sqrt(x.^2+y.^2));
- az = atan2(y,x);
-