function g = exptriangle(x,pos,wid,t)
%  Exponentially-broadened triangle(x,pos,wid, t) is triangle peak centered
%  on pos, half-width=wid, broadened by an exponential funciton of time
%  constant t. x may be scalar, vector, or matrix, pos, wid, and t are scalar
%  T. C. O'Haver, 2006
g = triangle(x,pos,wid);
g = ExpBroaden(g',t);
% ----------------------------------------------------------------------
function yb = ExpBroaden(y,t)
% ExpBroaden(y,t) zero pads y and convolutes result by an exponential decay
% of time constant t by multiplying Fourier transforms and inverse
% transforming the result.
hly=round(length(y)./2);
ey=[zeros(1,hly)';y;zeros(1,hly)'];
fy=fft(ey);
a=exp(-(1:length(fy))./t);
fa=fft(a);
fy1=fy.*fa';
ybz=real(ifft(fy1))./sum(a);
yb=ybz(hly+2:length(ybz)-hly+1);