Products & Services Solutions Academia Support User Community Company

Learn more about Signal Processing Toolbox   

realizemdl - Simulink subsystem block for filter.

Syntax

realizemdl(Hd)
realizemdl(Hd,propertyname1,propertyvalue1,...)

Description

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

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

realizemdl(Hd,propertyname1,propertyvalue1,...) generates the model for hq with the associated propertyname/propertyvalue pairs, and any other values you set in hq

Using the optional propertyname/propertyvalue pairs lets you control more fully the way the block subsystem model gets built, such as where the block goes, what the name is, or how to optimize the block structure. Valid properties and values for realizemdl are listed in this table, with the default value noted and descriptions of what the properties do.

Property Name

Property Values

Description

Destination

'current' (default) or 'new'or 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

'filter' (default)

Provides the name for the new subsystem block. By default the block is named 'filter'. To enter a name for the block, use the propertyvalue set to a string 'blockname'.

MapCoeffstoPorts

'off' (default) or 'on'

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

OverwriteBlock

'off' or 'on'

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

OptimizeZeros

'off' (default) or 'on'

Specify whether to remove zero-gain blocks.

OptimizeOnes

'off' (default) or 'on'

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

OptimizeNegOnes

'off' (default) or 'on'

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

OptimizeDelayChains

'off' (default) or 'on'

Specify whether to replace cascaded chains of delay blocks with a single integer delay block to provide an equivalent delay.

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.

Examples

Realize Simulink model of lowpass Butterworth filter:

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

The realized model is shown in the figure below:

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
realizemdl(Hd,'MapCoeffsToPorts','on');

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

design | fdesign

How To

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS