This is a static copy of a profile reportHome
fftshift (866 calls, 0.317 sec)
Generated 05-Aug-2011 13:00:40 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/datafun/fftshift.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 |
42 | y = x(idx{:}); | 866 | 0.142 s | 44.8% |  |
30 | idx{dim} = [p+1:m 1:p]; | 866 | 0.066 s | 20.7% |  |
27 | idx = repmat({':'}, 1, max(ndi... | 866 | 0.066 s | 20.7% |  |
23 | if nargin > 1 | 866 | 0.011 s | 3.4% |  |
29 | p = ceil(m/2); | 866 | 0 s | 0% |  |
All other lines | | | 0.033 s | 10.3% |  |
Totals | | | 0.317 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
repmat | function | 866 | 0.055 s | 17.2% |  |
Self time (built-ins, overhead, etc.) | | | 0.262 s | 82.8% |  |
Totals | | | 0.317 s | 100% | |
Code Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 42 |
Non-code lines (comments, blank lines) | 24 |
Code lines (lines that can run) | 18 |
Code lines that did run | 7 |
Code lines that did not run | 11 |
Coverage (did run/can run) | 38.89 % |
Function listing
time calls line
1 function y = fftshift(x,dim)
2 %FFTSHIFT Shift zero-frequency component to center of spectrum.
3 % For vectors, FFTSHIFT(X) swaps the left and right halves of
4 % X. For matrices, FFTSHIFT(X) swaps the first and third
5 % quadrants and the second and fourth quadrants. For N-D
6 % arrays, FFTSHIFT(X) swaps "half-spaces" of X along each
7 % dimension.
8 %
9 % FFTSHIFT(X,DIM) applies the FFTSHIFT operation along the
10 % dimension DIM.
11 %
12 % FFTSHIFT is useful for visualizing the Fourier transform with
13 % the zero-frequency component in the middle of the spectrum.
14 %
15 % Class support for input X:
16 % float: double, single
17 %
18 % See also IFFTSHIFT, FFT, FFT2, FFTN, CIRCSHIFT.
19
20 % Copyright 1984-2004 The MathWorks, Inc.
21 % $Revision: 5.11.4.4 $ $Date: 2010/08/23 23:07:36 $
22
0.01 866 23 if nargin > 1
866 24 if (~isscalar(dim)) || floor(dim) ~= dim || dim < 1
25 error(message('MATLAB:fftshift:DimNotPosInt'))
26 end
0.07 866 27 idx = repmat({':'}, 1, max(ndims(x),dim));
866 28 m = size(x, dim);
866 29 p = ceil(m/2);
0.07 866 30 idx{dim} = [p+1:m 1:p];
31 else
32 numDims = ndims(x);
33 idx = cell(1, numDims);
34 for k = 1:numDims
35 m = size(x, k);
36 p = ceil(m/2);
37 idx{k} = [p+1:m 1:p];
38 end
39 end
40
41 % Use comma-separated list syntax for N-D indexing.
0.14 866 42 y = x(idx{:});