This is a static copy of a profile reportHome
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 Name | Function Type | Calls |
genfigRms | function | 3 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
45 | Istop = Istop | (abs(f) < f... | 242 | 2.612 s | 78.1% |  |
49 | yc = (ifft(fftshift(Y,1))); | 3 | 0.404 s | 12.1% |  |
39 | Y = fftshift(fft(y),1); | 3 | 0.306 s | 9.2% |  |
40 | f = [-size(Y,1)/2:size(Y,1)/2-... | 3 | 0.011 s | 0.3% |  |
51 | end | 3 | 0 s | 0% |  |
All other lines | | | 0.011 s | 0.3% |  |
Totals | | | 3.345 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
fftshift | function | 6 | 0.153 s | 4.6% |  |
Self time (built-ins, overhead, etc.) | | | 3.192 s | 95.4% |  |
Totals | | | 3.345 s | 100% | |
Code Analyzer results
Line number | Message |
31 | The variable 'fstop' appears to change size on every loop iteration. Consider preallocating for speed. |
35 | The variable 'fstop' appears to change size on every loop iteration. Consider preallocating for speed. |
40 | Use of brackets [] is unnecessary. Use parentheses to group, if needed. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 51 |
Non-code lines (comments, blank lines) | 24 |
Code lines (lines that can run) | 27 |
Code lines that did run | 27 |
Code lines that did not run | 0 |
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