[5f391e]: filterbank / filterbank.m  Maximize  Restore  History

Download this file

50 lines (41 with data), 1.4 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
function c=filterbank(f,g,a);
%FILTERBANK Apply filterbank
% Usage: c=filterbank(f,g,a);
%
% `filterbank(f,g,a)` applies the filters given in *g* to the signal
% *f*. Each subband will be subsampled by a factor of *a* (the
% hop-size). In contrast to |ufilterbank|_, *a* can be a vector so the
% hop-size can be channel-dependant. If *f* is a matrix, the
% transformation is applied to each column.
%
% The filters *g* must be a cell-array, where each entry in the cell
% array corresponds to an FIR filter.
%
% The output coefficients are stored a cell array. More precisely, the
% n'th cell of *c*, `c{m}`, is a 2D matrix of size $M(n) \times W$ and
% containing the output from the m'th channel subsampled at a rate of
% $a(m)$. `c{m}(n,l)` is thus the value of the coefficient for time index
% *n*, frequency index *m* and signal channel *l*.
%
% References: bohlfe02
if nargin<3
error('%s: Too few input parameters.',upper(mfilename));
end;
[a,M,longestfilter,lcm_a]=assert_filterbankinput(g,a);
[f,Ls,W,wasrow,remembershape]=comp_sigreshape_pre(f,'FILTERBANK',0);
L=ceil(max(Ls,longestfilter)/lcm_a)*lcm_a;
N=L./a;
c=cell(M,1);
for m=1:M
c{m}=zeros(N(m),W);
end;
G=zeros(L,M);
for ii=1:M
G(:,ii)=fft(fir2long(g{ii},L));
end;
for w=1:W
F=fft(postpad(f(:,w),L));
for m=1:M
c{m}(:,w)=ifft(sum(reshape(F.*G(:,m),N(m),a(m)),2))/a(m);
end;
end;

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks