```--- a/filterbank/filterbankrealbounds.m
+++ b/filterbank/filterbankrealbounds.m
@@ -1,32 +1,30 @@
-function [AF,BF]=filterbankrealbounds(g,a,varargin);
+function [AF,BF]=filterbankrealbounds(g,a,L);
%FILTERBANKREALBOUNDS  Frame bounds of filter bank for real signals only
%   Usage: fcond=filterbankrealbounds(g,a);
%          [A,B]=filterbankrealbounds(g,a);
%
-%   `filterbankrealbounds(g,a)` calculates the ratio \$B/A\$ of the frame
-%   bounds of the filterbank specified by *g* and *a*. The ratio is a measure
-%   of the stability of the system.  Use this function on the common
-%   construction where the filters in *g* only covers the positive
-%   frequencies.
+%   `filterbankrealbounds(g,a,L)` calculates the ratio \$B/A\$ of the frame
+%   bounds of the filterbank specified by *g* and *a* for a system of length
+%   *L*. The ratio is a measure of the stability of the system.  Use this
+%   function on the common construction where the filters in *g* only covers
+%   the positive frequencies.
%
%   `[A,B]=filterbankrealbounds(g,a)` returns the lower and upper frame
%   bounds explicitly.
%

-if nargin<2
+if nargin<3
error('%s: Too few input parameters.',upper(mfilename));
end;

-[a,M,longestfilter,lcm_a]=assert_filterbankinput(g,a);
+if L~=filterbanklength(L,a)
+    error(['%s: Specified length L is incompatible with the length of ' ...
+           'the time shifts.'],upper(mfilename));
+end;

-
-definput.keyvals.L=[];
-[flags,kv,L]=ltfatarghelper({'L'},definput,varargin);
-
-if isempty(L)
-  L=ceil(longestfilter/lcm_a)*lcm_a;
-end;
+[g,info]=filterbankwin(g,a,L,'normal');
+M=info.M;

AF=Inf;
BF=0;
@@ -37,13 +35,17 @@

N=L/a;

-  G=zeros(L,M,assert_classname(g{1}));
-  for ii=1:M
-    G(:,ii)=fft(fir2long(g{ii},L));
+  % G1 is done this way just so that we can determine the data type.
+  G1=comp_transferfunction(g{1},L);
+  thisclass=assert_classname(G1);
+  G=zeros(L,M,thisclass);
+  G(:,1)=G1;
+  for ii=2:M
+    G(:,ii)=comp_transferfunction(g{ii},L);
end;

-  Ha=zeros(a,M,assert_classname(g{1}));
-  Hb=zeros(a,M,assert_classname(g{1}));
+  Ha=zeros(a,M,thisclass);
+  Hb=zeros(a,M,thisclass);

for w=0:N-1
idx_a = mod(w-(0:a-1)*N,L)+1;
```