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

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

return;