function out = daub6( n, t )
% Recursive function to generate the
% Daubechies 6 scaling function.
%
% M.V.Wickerhauser, 2008-04-01
%
sr2 = sqrt(2.0);
h0=sr2 * 3.32670552950082630E-01;
h1=sr2 * 8.06891509311092550E-01;
h2=sr2 * 4.59877502118491540E-01;
h3=sr2 * -1.35011020010254580E-01;
h4=sr2 * -8.54412738820266580E-02;
h5=sr2 * 3.52262918857095330E-02;

if (n>0)
   out = h0*daub6(n-1,2*t) + h1*daub6(n-1,2*t-1) + ...
        h2*daub6(n-1,2*t-2) + h3*daub6(n-1,2*t-3) + ...
        h4*daub6(n-1,2*t-4) + h5*daub6(n-1,2*t-5)  ;
else
   if ((t>=0) && (t<1) )
       out = 1;
   else
       out = 0;
   end
end
