Discrete Impulse

Generate discrete impulse





The Discrete Impulse block generates an impulse (the value 1) at output sample D+1, where D is specified by the Delay parameter (D0). All output samples preceding and following sample D+1 are zero.

When D is a length-N vector, the block generates an M-by-N matrix output representing N distinct channels, where frame size M is specified by the Samples per frame parameter. The impulse for the ith channel appears at sample D(i)+1. For M=1, the output is sample based; otherwise, the output is frame based.

The Sample time parameter value, Ts, specifies the output signal sample period. The resulting frame period is M*Ts.


Construct the modelmodel below.

Configure the Discrete Impulse block to generate a frame-based three-channel output of type double, with impulses at samples 1, 4, and 6 of channels 1, 2, and 3, respectively. Use a sample period of 0.25 and a frame size of 4. The corresponding settings should be as follows:

  • Delay = [0 3 5]

  • Sample time = 0.25

  • Samples per frame = 4

  • Output data type = double

Run the model and look at the output, dsp_examples_yout. The first few samples of each channel are shown below.


ans =
     1     0     0
     0     0     0
     0     0     0
     0     1     0
     0     0     0
     0     0     1
     0     0     0
     0     0     0
     0     0     0
     0     0     0

The block generates an impulse at sample 1 of channel 1 (first column), at sample 4 of channel 2 (second column), and at sample 6 of channel 3 (third column).

Dialog Box

The Main pane of the Discrete Impulse block dialog appears as follows.


The number of zero-valued output samples, D, preceding the impulse. A length-N vector specifies an N-channel output.

Sample time

The sample period, Ts, of the output signal. The output frame period is M*Ts.

Samples per frame

The number of samples, M, in each output frame. When the value of this parameter is 1, the block outputs a sample-based signal.

The Data Types pane of the Discrete Impulse block dialog appears as follows.

Output data type

Specify the output data type for this block. You can select one of the following:

  • A rule that inherits a data type, for example, Inherit: Inherit via back propagation. When you select this option, the output data type and scaling matches that of the next downstream block.

  • A built in data type, such as double

  • An expression that evaluates to a valid data type, for example, fixdt(1,16)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.

See Specify Block Output Data Types for more information.

Supported Data Types

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point

  • Boolean

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

See Also

Data Type ConversionSimulink
Multiphase ClockDSP System Toolbox
N-Sample EnableDSP System Toolbox
Signal From WorkspaceDSP System Toolbox
impzSignal Processing Toolbox

Was this topic helpful?