function out = daub4( n, t )
% Recursive function to generate the
% Daubechies 4 scaling function.
%
% M.V.Wickerhauser, 2008-04-01
%
sr3 = sqrt(3);
h0=(1+sr3)/4;
h1=(3+sr3)/4;
h2=(3-sr3)/4;
h3=(1-sr3)/4;
if (n>0)
   out = h0*daub4(n-1,2*t) + h1*daub4(n-1,2*t-1) + h2*daub4(n-1,2*t-2) + h3*daub4(n-1,2*t-3);
else
   if ((t>=0) && (t<1) )
       out = 1;
   else
       out = 0;
   end
end
