[797cbb]: filterbank / filterbanklength.m Maximize Restore History

Download this file

filterbanklength.m    42 lines (34 with data), 986 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
36
37
38
39
40
41
function L=filterbanklength(Ls,a);
%FILTERBANKLENGTH Filterbank length from signal
% Usage: L=filterbanklength(Ls,a);
%
% `filterbanklength(Ls,a)` returns the length of a filterbank with
% time shifts *a*, such that it is long enough to expand a signal of
% length *Ls*.
%
% If the filterbank length is longer than the signal length, the signal
% will be zero-padded by |filterbank| or |ufilterbank|.
%
% If instead a set of coefficients are given, call |filterbanklengthcoef|.
%
% See also: filterbank, filterbanklengthcoef
if ~isnumeric(Ls)
error('%s: Ls must be numeric.',upper(mfilename));
end;
if ~isscalar(Ls)
error('%s: Ls must a scalar.',upper(mfilename));
end;
if ~isnumeric(a)
error('%s: a must be numeric.',upper(mfilename));
end;
%if ~isvector(a)
%
%end;
if any(a<=0)
error('%s: "a" must consists of positive numbers only.',upper(mfilename));
end;
lcm_a=a(1);
for m=2:length(a)
lcm_a=lcm(lcm_a,a(m,1));
end;
L=ceil(Ls/lcm_a)*lcm_a;