% error: y=pulstran(t,d,'func',...) % y=pulstran(t,d,p,Fs,'interp') % % Generate the signal y=sum(func(t+d,...)) for each d. If d is a % matrix of two columns, the first column is the delay d and the second % column is the amplitude a, and y=sum(a*func(t+d)) for each d,a. % Clearly, func must be a function which accepts a vector of times. % Any extra arguments needed for the function must be tagged on the end. % % Example % fs = 11025; % arbitrary sample rate % f0 = 100; % pulse train sample rate % w = 0.001; % pulse width of 1 millisecond % auplot(pulstran(0:1/fs:0.1, 0:1/f0:0.1, 'rectpuls', w), fs); % % If instead of a function name you supply a pulse shape sampled at % frequency Fs (default 1 Hz), an interpolated version of the pulse % is added at each delay d. The interpolation stays within the the % time range of the delayed pulse. The interpolation method defaults % to linear, but it can be any interpolation method accepted by the % function interp1. % % Example % fs = 11025; % arbitrary sample rate % f0 = 100; % pulse train sample rate % w = boxcar(10); % pulse width of 1 millisecond at 10 kHz % auplot(pulstran(0:1/fs:0.1, 0:1/f0:0.1, w, 10000), fs);