This is a static copy of a profile report

Home

notchFilter (3 calls, 3.345 sec)
Generated 05-Aug-2011 13:03:47 using cpu time.
function in file /home/LeechJ/cbass_analysis/matutils/notchFilter.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
genfigRmsfunction3
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
45
Istop = Istop | (abs(f) < f...
2422.612 s78.1%
49
yc = (ifft(fftshift(Y,1)));
30.404 s12.1%
39
Y = fftshift(fft(y),1);
30.306 s9.2%
40
f = [-size(Y,1)/2:size(Y,1)/2-...
30.011 s0.3%
51
end
30 s0%
All other lines  0.011 s0.3%
Totals  3.345 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
fftshiftfunction60.153 s4.6%
Self time (built-ins, overhead, etc.)  3.192 s95.4%
Totals  3.345 s100% 
Code Analyzer results
Line numberMessage
31The variable 'fstop' appears to change size on every loop iteration. Consider preallocating for speed.
35The variable 'fstop' appears to change size on every loop iteration. Consider preallocating for speed.
40Use of brackets [] is unnecessary. Use parentheses to group, if needed.
Coverage results
[ Show coverage for parent directory ]
Total lines in function51
Non-code lines (comments, blank lines)24
Code lines (lines that can run)27
Code lines that did run27
Code lines that did not run0
Coverage (did run/can run)100.00 %
Function listing
   time   calls  line
1 function yc = notchFilter(varargin)
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 % This function applies a notch filter to the columns of data in y. It
4 % assumes that they've been sampled at 100 Hz.
5 %
6 % OGK, 17 May 2010
7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8
3 9 if nargin == 1
1 10 y = varargin{1};
2 11 else
2 12 y = varargin{1};
2 13 fstopE = varargin{2};
2 14 end
15
16 % Frequencies to cut out: [Flow Fhigh]
3 17 fstop = [1.18 1.24;
18 2.36 2.44;
19 3.596 3.604;
20 4.76 4.84;
21 7.16 7.24;
22 8.36 8.44;
23 0.999 1.001;
24 19.92 20.04;
25 39.9 40.1];
3 26 if nargin > 1
2 27 fstop = [fstop; fstopE];
2 28 end
29
3 30 for k=1:50
150 31 fstop = [fstop; k-0.02 k+0.02];
150 32 end
33
3 34 for k=0.5:1:20.5
63 35 fstop = [fstop; k-0.02 k+0.02];
63 36 end
37
3 38 fs = 100;
0.31 3 39 Y = fftshift(fft(y),1);
0.01 3 40 f = [-size(Y,1)/2:size(Y,1)/2-1]*fs/size(Y,1);
3 41 f = f(:);
42
3 43 Istop = zeros(size(f));
3 44 for k=1:size(fstop,1)
2.61 242 45 Istop = Istop | (abs(f) < fstop(k,2) & abs(f) > fstop(k,1));
242 46 end
3 47 Y(Istop,:) = 0;
48
0.40 3 49 yc = (ifft(fftshift(Y,1)));
50
3 51 end