pulse generation
y = pulstran(t, d, func,...) y = pulstran(t, d, p, Fs, 'interp')
rectangular pulse, parameter are (w) (default w=1)
triangular pulse, parameter are (w, skew) (default w=1,skew=0)
gaussian monopulse, parameter are (fc) (default fc=1e3)
Gaussian modulated sinusoidal pulse, parameter are (fc, bw) (default fc=1e3, bw=0.5)
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.
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.
fs = 11025; // arbitrary sample rate f0 = 100; // pulse train sample rate w = 0.001; // pulse width of 1 millisecond plot(pulstran(0:1/fs:0.1, 0:1/f0:0.1, 'rectpuls', w)); fs = 11025; // arbitrary sample rate f0 = 100; // pulse train sample rate w = ones(10,1); // pulse width of 1 millisecond at 10 kHz plot(pulstran(0:1/fs:0.1, 0:1/f0:0.1, w, 10000)); | ![]() | ![]() |