function w = ffbe(a,v,wi,Abe);
% w = ffbe(a,v,wi,Abe);
% find band edges of an FIR filter using Newton's method
% using initial estimates
%
% A   : A(w) = cos(w*v)*a;
% wi  : initial values for the band edges
% Abe : value of H at the band edges
%
a = a(:);
v = v(:)';
w = wi(:);
Abe = Abe(:);
for k = 1:15
   A = cos(w*v) * a - Abe;
   A1 = -sin(w*v) * (v'.*a);
   w = w - A./A1;
end

