Main Content


Generate block from a digital filter




block(hd) generates a DSP System Toolbox™ block equivalent to the digital filter, hd.

block(hd,'propertyname1',propertyvalue1,'propertyname2',propertyvalue2,...) generates a DSP System Toolbox block using the options specified in the property name/property value pairs. The valid properties and their values are

Property Name

Property Values

Description and Values


'current' (default), 'new', or Subsystemname.

Determine which Simulink® model gets the block. Enter 'current', 'new', or specify the name of an existing subsystem with subsystemname. 'current' adds the block to your current Simulink model. Specifying 'new' opens a new model and adds the block. Specifying 'new' opens a new model and adds the block. If you provide the name of a subsystem in subsystemname, block adds the new block to your specified subsystem.


'filter' (default)

Specify the name of the generated block. The name appears below the block in the model. When you do not specify a block name, the default is filter.


'off' (default), or 'on'.

Tell block whether to overwrite an existing block of the same name, or create a new block. 'off' is the default setting—block does not overwrite existing blocks with matching names. Switching from 'off' to 'on' directs block to overwrite existing blocks.


'off' (default), or 'on'.

Specify whether to apply the current filter states to the new block. This lets you save states from a filter object you may have used or configured in a specific way. The default setting of 'off' means the states are not transferred to the block. Choosing 'on' preserves the current filter states in the block.


'off' (default), or 'on'.

Specify how to set the Coefficient source in the block mask. The default setting is 'off' and the Coefficient source is set to Dialog parameters. Setting Link2Obj to 'on' sets the Coefficient source to Discrete-time filter object (DFILT). The Link2Obj and MapCoeffstoPorts cannot be simultaneously 'on'.


'off' (default) or 'on'

Specify whether to map the coefficients of the filter to the ports of the block. The Link2Obj and MapCoeffstoPorts cannot be simultaneously 'on'.


{'Num'} (default FIR)

{'Num','Den'} (default direct form IIR)

{'Num','Den','g'} (default IIR SOS),

{'K'} (default form lattice)

Specify the coefficient variable names as a cell array of character vectors.

MapCoeffsToPorts must be set to 'on' for this property to apply.


'columns as channels' (default), 'elements as channels'

Specify sample-based (elements as channels) or frame-based (columns as channels) processing.


'enforce single rate' (default) or 'allow multirate'

Specify how the block adjusts the rate at the output to accommodate the reduced number of samples. This parameter applies only when InputProcessing is 'columns as channels'.

Using block to Realize a Fixed-Point Digital Filter

When the source filter hd is fixed-point, the input word and fraction lengths for the block are derived from the block input signal. The realization process issues a warning and ignores the input word and input fraction lengths that are part of the source filter object, choosing to inherit the settings from the input data. Other fixed-point properties map directly to settings for word and fraction length in the realized block.


collapse all

Create a lowpass filter specification object. Specify the passband frequency to be $0.15{\pi}$ rad/sample and the stopband frequency to be $0.25{\pi}$ rad/sample. Specify 1 dB of allowable passband ripple and a stopband attenuation of 60 dB.

In the first example, use block with the default syntax, letting the function determine the block name and configuration.

d = fdesign.lowpass('Fp,Fst,Ap,Ast',0.15,0.25,1,60);
hd = design(d);

Now use the default syntax to create a block.


In this second example, define the block name to meet your needs by using the property name/property value pair input arguments.

block(hd, 'blockname', 'FIR Filter');

The figure shows the blocks in a Simulink model. When you try these examples, you see that the second block writes over the first block location. You can avoid this by moving the first block before you generate the second, always naming your block with the blockname property, or setting the Destination property to new which puts the filter block in a new Simulink model.

Introduced in R2011a