%
%  This function implements a unit triangle function
%
%  triangle((t)/W) = 1-|t|/W for |t|<W, and is zero otherwise
%
function x = unit_triangle(t,W);

x = (1-abs(t)/W).*(abs(t)<W);

return;