Documentation Center

  • Trial Software
  • Product Updates

block

Generate block from multirate or multistage filter

Syntax

block(hm)
block(hm,'propertyname1',propertyvalue1,'propertyname2',propertyvalue2,...)

Description

block(hm) generates a DSP System Toolbox™ block equivalent to hm.

block(hm,'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

Destination

'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.

Blockname

'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.

OverwriteBlock

'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.

MapStates

'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.

Link2Obj

'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'.

MapCoeffstoPorts

'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'. See mfilt for a list of supported filter objects.

CoeffNames

{'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 string variables in a cell array.

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

InputProcessing

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

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

The Inherited (this choice will be removed - see release notes) option will be removed in a future release.

RateOption

'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 Fixed-Point Multirate Filters

When the source filter hm 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.

Examples

Two examples of using block demonstrate the syntax capabilities. Both examples start from an mfilt object with interpolation factor of three. In the first example, use block with the default syntax, letting the function determine the block name and configuration.

hm = mfilt.firdecim(3);

Now use the default syntax to create a block.

block(hm);

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

block(hm, 'blockname', 'firdecim');

The figure below 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.

See Also

Was this topic helpful?