--- a/fourier/firfilter.m
+++ b/fourier/firfilter.m
@@ -1,4 +1,4 @@
-function g=firfilter(name,M,varargin)
+function gout=firfilter(name,M,varargin)
 %FIRFILTER  Construct an FIR filter
 %   Usage:  g=firfilter(name,M);
 %           g=firfilter(name,M,...);
@@ -9,6 +9,12 @@
 %
 %   `firfilter(name,M,centre)` constructs a filter with a centre
 %   frequency of *centre* measured in normalized frequencies.
+%
+%   If one of the inputs is a vector, the output will be a cell array
+%   with one entry in the cell array for each element in the vector. If
+%   more input are vectors, they must have the same size and shape and the
+%   the filters will be generated by stepping through the vectors. This
+%   is a quick way to create filters for |filterbank| and |ufilterbank|.
 %
 %   `firfilter` accepts the following optional parameters:
 %
@@ -50,6 +56,8 @@
 
 [flags,kv]=ltfatarghelper({'centre'},definput,varargin);
 
+[M,kv.centre,kv.delay]=scalardistribute(M,kv.centre,kv.delay);
+
 if ~isempty(kv.fs)
     M=round(M*kv.fs);
     kv.centre=kv.centre/kv.fs*2;
@@ -64,11 +72,22 @@
     g.offset=d-floor(M/2);
 end;
 
-g.h=fftshift(firwin(name,M,'shift',smallshift,flags.norm));
-g.centre=kv.centre;
-g.realonly=flags.do_real;
-g.fs=kv.fs;
+Nfilt=numel(M);
+gout=cell(1,Nfilt);
+for ii=1:Nfilt
+    g=struct();
+    g.h=fftshift(firwin(name,M(ii),'shift',smallshift(ii),flags.norm));
+    g.centre=kv.centre(ii);
+    g.realonly=flags.do_real;
+    g.fs=kv.fs;
+    gout{ii}=g;
+end;
+if Nfilt==1
+    gout=g;
+end;
 
 
 
 
+
+