[d20d5a]: / filterbank / filterbanklengthcoef.m  Maximize  Restore  History

Download this file

38 lines (29 with data), 889 Bytes

 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
function L=filterbanklengthcoef(coef,a);
%FILTERBANKLENGTHCOEF Filterbank length from coefficients
% Usage: L=filterbanklengthcoef(coef,a);
%
% `filterbanklengthcoef(coef,a)` returns the length of a filterbank with
% time-shifts *a*, such that the filterbank is long enough to expand the
% coefficients *coef*.
%
% If instead a signal is given, call |filterbanklength|_.
%
% See also: filterbank, filterbanklength
if iscell(coef)
Mcoef=numel(coef);
cl=cellfun(@numel,coef);
else
Mcoef=size(coef,2);
cl=ones(1,Mcoef)*size(coef,1);
end;
a=a(:);
cl=cl(:);
% Make 'a' have the length of '
a=bsxfun(@times,a,ones(numel(cl),1));
L=a.*cl;
if var(L)>0
error(['%s: Invalid set of coefficients. The product of the no. of ' ...
'coefficients and the channel time shift must be the same for ' ...
'all channels.'],upper(mfilename));
end;
L=L(1);