function showpulse(index)
% plot the requested pulse as a function of time on interval [0..1000] ns.
%   index = 0 for input pulse, ivar for selected signal

outpulsefft = pulsefft(index,[]);
outpulse = ifft(outpulsefft);
t=.1:.1:1000;
plot(t,real(outpulse));
integrl = sum(outpulse(1:450))*.1;
peakh = max(outpulse(1:450));
width = integrl/peakh;
cprintf('black','peak integral = %f V ns\n',integrl);
cprintf('black','peak height = %f V\n',peakh);
cprintf('black','peak width = %f ns\n',width);

peakl = min(outpulse(1:1000));
olast = peakl;
for n=1:1000
  othis = outpulse(n);
  if abs(olast-peakl) < abs(peakh-peakl)*0.1 && ...
     abs(othis-peakl) > abs(peakh-peakl)*0.1
    nlast = n;
  elseif abs(olast-peakl) < abs(peakh-peakl)*0.9 && ...
         abs(othis-peakl) > abs(peakh-peakl)*0.9
    trise = (n-nlast)*0.1;
  elseif abs(olast-peakl) > abs(peakh-peakl)*0.9 && ...
         abs(othis-peakl) < abs(peakh-peakl)*0.9
    nlast = n;
  elseif abs(olast-peakl) > abs(peakh-peakl)*0.1 && ...
         abs(othis-peakl) < abs(peakh-peakl)*0.1
    tfall = (n-nlast)*0.1;
  end
  olast = othis;
end
cprintf('black','fall, rise time = %f, %f ns\n',tfall,trise);
