function out = hatfn( n, t )
% Recursive function to generate the
% hat function scaling function.
%
% M.V.Wickerhauser, 2008-04-01
%
h0= (1.0/4.0);
h1= (1.0/2.0);
h2= (1.0/4.0);
if (n>0)
   out = h0*hatfn(n-1,2*t) + h1*hatfn(n-1,2*t-1) + h2*hatfn(n-1,2*t-2);
else
   if ((t>=0) && (t<1) )
       out = 1;
   else
       out = 0;
   end
end
