THE AUDITORY MODELING TOOLBOX

Applies to version: 1.6.0

View the code

Go to function

sig_pulsetrain
Generate a (modulated) pulse train

Usage:

stim = sig_pulsetrain(dur, pulse_rate, pulse);
stim = sig_pulsetrain(dur, pulse_rate, pulse, fs);
stim = sig_pulsetrain(dur, pulse_rate, pulse, fs, env);
[stim, num_pulses] = sig_pulsetrain(..);

Input parameters:

dur Duration (in s) of stim to be generated.
pulse_rate Rate of the pulses (in pulses per second, pps).
pulse Vector representing the temporal signature of a single pulse.
fs Optional sampling frequency (in Hz) of pulse and stim. Default: 1 MHz.
env Optional envelope to be imposed on the pulse train. Must have the length equal to round(dur*fs). Default: No envelope applied.

Output parameters:

stim Vector containing the pulse train with the sampling frequency fs. The length of stim will be round(dur*fs).
num_pulses Number of pulses required to create the pulse train.

Description:

sig_pulsetrain(..) generates a pulse train containing superimposed copies of the pulse signature pulse, copied at the rate of pulse_rate.

If the optional envelope in env is provided, the pulse train stim is scaled with the amplitudes from env at the starting point of the pulse. Otherwise no scaling is done.