This is a static copy of a profile report

Home

nextpow2 (138 calls, 0.011 sec)
Generated 05-Aug-2011 13:03:46 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/elfun/nextpow2.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
filter_datafunction72
plot_powerspecfunction66
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
23
p(k) = f(k);
1380 s0%
22
k = ~isfinite(f);
1380 s0%
19
p(k) = p(k)-1;
1380 s0%
18
k = (f == 0.5);
1380 s0%
15
[f,p] = log2(abs(n));
1380 s0%
All other lines  0.011 s100.0%
Totals  0.011 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function23
Non-code lines (comments, blank lines)18
Code lines (lines that can run)5
Code lines that did run5
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
   time   calls  line
1 function p = nextpow2(n)
2 %NEXTPOW2 Next higher power of 2.
3 % NEXTPOW2(N) returns the first P such that 2.^P >= abs(N). It is
4 % often useful for finding the nearest power of two sequence
5 % length for FFT operations.
6 %
7 % Class support for input N:
8 % float: double, single
9 %
10 % See also LOG2, POW2.
11
12 % Copyright 1984-2009 The MathWorks, Inc.
13 % $Revision: 5.11.4.4 $ $Date: 2009/07/06 20:37:15 $
14
138 15 [f,p] = log2(abs(n));
16
17 % Check for exact powers of 2.
138 18 k = (f == 0.5);
138 19 p(k) = p(k)-1;
20
21 % Check for infinities and NaNs
138 22 k = ~isfinite(f);
138 23 p(k) = f(k);