function [h,h1,h2] = daub(K)
% DAUB: Daubechies Scaling FIlter
%
% [h,h1,h2] = daub(K);
% input 
%   K : number of zeros at PI
% output
%   h   : numerator coefficients
%   h   : h = conv(h1,h2); h1 contains all zeros at z=-1,
%           h2 contains all other zeros.
%
%  % Example: Daubechies length 8 filter:
%	[h,h1,h2] = daub(4);

[h,h1,h2] = maxflatI(K,K);

r1 = -ones(K,1);
r2 = roots(h2);
r2 = r2(abs(r2)<1);
r = [r1; r2];
h = real(poly(r));

% normalize
A = sqrt(2)/sum(h);
h = A*h;
h2 = A*h2;

