 function phi = hat(k,N);

% function phi = hat(k,N);
% 
% creates a Chebfun for the hat function phi_k  for the interval [0,1] 
% on a uniform grid with x_k = k h = k/(N+1).

 x = chebfun('x',[0 1],'splitting','on');
 xk = k/(N+1);     
 phi = max(0,1-abs((x-xk)*(N+1)));    % chebfun for the hat function phi_k(x) 
