This is a static copy of a profile reportHome
Tukey_filter (72 calls, 5.542 sec)
Generated 05-Aug-2011 13:03:50 using cpu time.
function in file /home/LeechJ/cbass_analysis/reduc/Tukey_filter.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 |
48 | filter(NFFT-i+1) = 0.5 * (1+co... | 704736 | 0.612 s | 11.0% |  |
57 | filter(NFFT-i+1) = 1-(0.5 * (1... | 704688 | 0.579 s | 10.5% |  |
33 | filter = ones(1,NFFT); | 72 | 0.514 s | 9.3% |  |
56 | filter(i) = 1-(0.5 * (1+cos((p... | 704688 | 0.481 s | 8.7% |  |
47 | filter(i) = 0.5 * (1+cos((pi*j... | 704736 | 0.470 s | 8.5% |  |
All other lines | | | 2.886 s | 52.1% |  |
Totals | | | 5.542 s | 100% | |
Children (called functions)
No childrenCode Analyzer results
Line number | Message |
1 | Input argument 'x' might be unused. If this is OK, consider replacing it by ~. |
29 | The value assigned to variable 'x' might be unused. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 65 |
Non-code lines (comments, blank lines) | 38 |
Code lines (lines that can run) | 27 |
Code lines that did run | 23 |
Code lines that did not run | 4 |
Coverage (did run/can run) | 85.19 % |
Function listing
time calls line
1 function filter = Tukey_filter(f1,f2,f3,f4,Fs,NFFT,x)
2
3 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4 % filter = tukey_bandstop(f1,f2,f3,f4,Fs,n_points,x)
5 %
6 % Function to generate a Tukey bandstop filter (cosine edged band stop)
7 %
8 % ----- ------
9 % |\ /|
10 % | \ / |
11 % | ------ |
12 % f1 | | |
13 % f2 f3 f4
14 % Inputs:
15 % f1,f2,f3,f4
16 % (Optional) Fs, n_points, x
17 % These are automatically picked up when using filter_data.m
18 % If not given then resorts to default of Fs = 100 ,
19 % n_points =1000 (was useful for independent checking).
20 %
21 %
22 %
23 % act 2/9/2010
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25
72 26 if(nargin<7)
27 Fs = 100;
28 NFFT = 1000;
29 x = Fs/2 * linspace(0,1,NFFT);
30 end
31
32
0.51 72 33 filter = ones(1,NFFT);
34
72 35 n_points = NFFT/2+1;
72 36 n1 = floor(f1 * n_points / (Fs/2));
72 37 n2 = floor(f2 * n_points / (Fs/2));
72 38 n3 = floor(f3 * n_points / (Fs/2));
72 39 n4 = floor(f4 * n_points / (Fs/2));
40
41
42 %Calculate lower edge
43
72 44 for i = n1:n2
0.42 704736 45 range = n2-n1;
0.43 704736 46 j=i-n1;
0.47 704736 47 filter(i) = 0.5 * (1+cos((pi*j)/(range)));
0.61 704736 48 filter(NFFT-i+1) = 0.5 * (1+cos((pi*j)/(range)));
0.42 704736 49 end
50
51 %Calculate upper edge
52
72 53 for i = n3:n4
0.45 704688 54 range = n4-n3;
0.42 704688 55 j=i-n3;
0.48 704688 56 filter(i) = 1-(0.5 * (1+cos((pi*j)/(range))));
0.58 704688 57 filter(NFFT-i+1) = 1-(0.5 * (1+cos((pi*j)/(range))));
0.43 704688 58 end
59
60 %Centre region of filter
61
72 62 for i = n2+1 : n3-1
0.10 201240 63 filter(i)=0;
0.14 201240 64 filter(NFFT-i+1)=0;
0.09 201240 65 end
Other subfunctions in this file are not included in this listing.