This is a static copy of a profile reportHome
cart2sph (5 calls, 0.809 sec)
Generated 05-Aug-2011 13:01:32 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/specfun/cart2sph.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
23 | az = atan2(y,x); | 5 | 0.251 s | 31.1% |  |
22 | elev = atan2(z,hypotxy); | 5 | 0.208 s | 25.7% |  |
20 | hypotxy = hypot(x,y); | 5 | 0.186 s | 23.0% |  |
21 | r = hypot(hypotxy,z); | 5 | 0.164 s | 20.3% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.809 s | 100% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 23 |
Non-code lines (comments, blank lines) | 19 |
Code lines (lines that can run) | 4 |
Code lines that did run | 4 |
Code lines that did not run | 0 |
Coverage (did run/can run) | 100.00 % |
Function listing
time calls line
1 function [az,elev,r] = cart2sph(x,y,z)
2 %CART2SPH Transform Cartesian to spherical coordinates.
3 % [TH,PHI,R] = CART2SPH(X,Y,Z) transforms corresponding elements of
4 % data stored in Cartesian coordinates X,Y,Z to spherical
5 % coordinates (azimuth TH, elevation PHI, and radius R). The arrays
6 % X,Y, and Z must be the same size (or any of them can be scalar).
7 % TH and PHI are returned in radians.
8 %
9 % TH is the counterclockwise angle in the xy plane measured from the
10 % positive x axis. PHI is the elevation angle from the xy plane.
11 %
12 % Class support for inputs X,Y,Z:
13 % float: double, single
14 %
15 % See also CART2POL, SPH2CART, POL2CART.
16
17 % Copyright 1984-2005 The MathWorks, Inc.
18 % $Revision: 5.12.4.2 $ $Date: 2005/05/31 16:31:21 $
19
0.19 5 20 hypotxy = hypot(x,y);
0.16 5 21 r = hypot(hypotxy,z);
0.21 5 22 elev = atan2(z,hypotxy);
0.25 5 23 az = atan2(y,x);