|
18 | 18 | % matrix. Every collumn correspond to a filter. The coefficients are |
19 | 19 | % ordered such that c(j+1) is j'th Chebyshev coefficient |
20 | 20 | % |
21 | | -% *param* contain only one field param.verbose to controle the verbosity. |
| 21 | +% Additional parameters |
| 22 | +% --------------------- |
| 23 | +% |
| 24 | +% * *param.use_chebfun* : 1 to use the Chebfun package to compute |
| 25 | +% Chebyshev coefficients |
| 26 | +% * *param.splitting_on* : 1 to call chebfun with splitting on |
| 27 | +% * *param.verbose* : Verbosity level (0 no log - 1 display warnings) |
| 28 | +% (default 1). |
22 | 29 | % |
23 | 30 | % Example::: |
24 | 31 | % |
|
33 | 40 | % See also: gsp_cheby_op gsp_filter_analysis |
34 | 41 | % |
35 | 42 |
|
36 | | -% Author: David K Hammond, Nathanael Perraudin |
| 43 | +% Author: David K Hammond, Nathanael Perraudin, David Shuman |
37 | 44 | % Testing: test_filter |
38 | 45 | % Date: 19 March 2014 |
39 | 46 |
|
|
75 | 82 | else |
76 | 83 | arange = G; |
77 | 84 | end |
78 | | - |
79 | | -a1=(arange(2)-arange(1))/2; |
80 | | -a2=(arange(2)+arange(1))/2; |
81 | | -c = zeros(m+1,1); |
82 | | -for ii=1:m+1 |
83 | | - c(ii) = sum( filter( a1* cos( (pi*((1:N)-0.5))/N) + a2) .* ... |
84 | | - cos( pi*(ii-1)*((1:N)-.5)/N) ) *2/N; |
| 85 | + |
| 86 | +if ~isfield(param,'use_chebfun'), param.use_chebfun = 0; end; |
| 87 | + |
| 88 | +if param.use_chebfun % Use Chebfun package, available at (http://www.chebfun.org/) |
| 89 | + if ~isfield(param,'splitting_on'), param.splitting_on = 0; end; |
| 90 | + if param.splitting_on |
| 91 | + h=chebfun(@(s) filter(s),arange,'splitting','on'); |
| 92 | + else |
| 93 | + h=chebfun(@(s) filter(s),arange); |
| 94 | + end |
| 95 | + c=chebcoeffs(h,m+1); |
| 96 | + c(1)=c(1)*2; |
| 97 | +else |
| 98 | + a1=(arange(2)-arange(1))/2; |
| 99 | + a2=(arange(2)+arange(1))/2; |
| 100 | + c = zeros(m+1,1); |
| 101 | + for ii=1:m+1 |
| 102 | + c(ii) = sum( filter( a1* cos( (pi*((1:N)-0.5))/N) + a2) .* ... |
| 103 | + cos( pi*(ii-1)*((1:N)-.5)/N) ) *2/N; |
| 104 | + end |
85 | 105 | end |
86 | 106 |
|
87 | 107 | end |
|
0 commit comments