function bw = binwin(len, nb)
%
 
if nb < 2, error ('number of bits too low'); end;
if nb > 30, error ('number of bits too high'); end;
ng = len - 2*nb;
if ng < 1, error ('length too short for given number of bits'); end;
 
right = 2*ones(1,nb);
right = right .^ (-(1:nb));
bw = [right(nb:-1:1) ones(1,ng) right];
