Simulink subsystem block for filter




realizemdl(hq) generates a model of filter hq in a Simulink® subsystem block using sum, gain, and delay blocks from Simulink. The properties and values of hq define the resulting subsystem block parameters.

realizemdl requires Simulink. To accurately realize models of quantized filters, use Fixed-Point Designer™.

realizemdl(hq,Name,Value) generates the model for hq with additional options specified by one or more Name,Value pair arguments. Using name-value pair arguments lets you control more fully the way the block subsystem model gets built. You can specify such details as where the block goes, what the name is, or how to optimize the block structure.

    Note   Subsystem filter blocks that you use realizemdl to create support sample-based input and output only. You cannot input or output frame-based signals with the block.

Input Arguments

collapse all


One of the following types of filter object or filter System object™:

Name-Value Pair Arguments

'Destination' — Destination choices:'current' (default) | 'new' | subsystemname

Specify whether to add the block to your current Simulink model or create a new model to contain the block. If you provide the name of a current subsystem in subsystemname, realizemdl adds the new block to the specified subsystem.

'Blockname' — The name of the block (not the default) :'filter' (default)

Provide the name for the new subsystem block. By default the block is named Filter.

'MapCoeffstoPorts' — Value options:'off' (default) | 'on'

Specify whether to map the coefficients of the filter to the ports of the block.

'MapStates' — Value options:'off' (default) | 'on'

Specify whether to apply the current filter states to the realized model. Such specification allows you to 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 model. Setting the property to 'on' preserves the current filter states in the realized model.

'OverwriteBlock' — Value options:'off' (default) | 'on'

Specify whether to overwrite an existing block with the same name or create a new block.

'OptimizeZeros' — Value options:'off' (default) | 'on'

Specify whether to remove zero-gain blocks.

'OptimizeOnes' — Value options:'off' (default) | 'on'

Specify whether to replace unity-gain blocks with direct connections.

'OptimizeNegOnes' — Value options:'off' (default) | 'on'

Specify whether to replace negative unity-gain blocks with a sign change at the nearest sum block.

'OptimizeDelayChains' — Value options:'off' (default) | 'on'

Specify whether to replace delay chains made up of n unit delays with a single delay by n.

'CoeffNames' — Names of coefficients:{'Num'} (default FIR) | {'Num','Den'} (default direct form IIR) | {'Num','Den','g'} (default IIR SOS) | {'Num_1,'Num_2,'Num_3'...} (default multistage) | {'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' — Possible input processing options:'columns as channels' (default) | 'elements as channels' | 'inherited'

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

    Note:   The ‘inherited' option will be removed in a future release.

'RateOption' — Rate options:'enforce single rate' (default) | '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'.

'Arithmetic' — Value types:'double' | 'single' | 'fixed'

For filter System object inputs only, specify the arithmetic used during analysis. The arithmetic for System object inputs must be 'double' or 'single'. The arithmetic for mfilt and dfilt object inputs can be 'fixed' or 'double' or 'single'.


Realize Simulink model of lowpass Butterworth filter:

d = fdesign.lowpass('N,F3dB',4,0.25);
Hd = design(d,'butter');

The realized model is shown in the figure:

Realize Simulink model with coefficients mapped to ports:

d = fdesign.lowpass('N,F3dB',4,0.25);
Hd = design(d,'butter');
%Realize Simulink model and export coefficients

In this case, the filter is an IIR filter with a direct form II second-order sections structure. Setting MapCoeffstoPorts to 'on' exports the numerator coefficients, the denominator coefficients, and the gains to the MATLAB® workspace using the default variable names Num, Den, and g. Each column of Num and Den represents one second-order section. You can modify the filter coefficients directly in the MATLAB workspace providing tunability to the realized Simulink model.

See Also


Introduced in R2011a

Was this topic helpful?