realizemdl - Simulink subsystem block for filter

Syntax

realizemdl(hq)
realizemdl(hq,propertyname1,propertyvalue1,...)

Description

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 Simulink Fixed-Point.

realizemdl(hq,propertyname1,propertyvalue1,...) generates the model or 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'.

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.

Examples

To demonstrate how realizemdl works to create models, these two examples show the default and optional syntaxes in use. Both examples begin from a quantized filter designed by butter in Signal Processing Toolbox documentation.

[b,a] = butter(4,.5);
hq = dfilt.df1(b,a);

Example 1

Using the default syntax to realize a model of your quantized filter hq. When you use this syntax, realizemdl uses blocks from Simulink and Simulink Fixed-Point to realize the subsystem in your current Simulink model.

realizemdl(hq);

Look at the figure to see the model as realized by realizemdl.

Example 2

Using propertyname/propertyvalue pairs to specify the features of the subsystem block model created by realizemdl.

First, convert the filter to fixed-point arithmetic to ensure a few zero valued coefficients:

hq.arithmetic = 'fixed';

Your filter has two zero value denominators, a(2) and a(4):

 FilterStructure: 'Direct-Form I'
      Arithmetic: 'fixed'
        Numerator: [0.0940 0.3759 0.5639 0.3759 0.0940]
    Denominator: [1 0 0.4860 0 0.0176]
PersistentMemory: false
          States: Numerator:  [4x1 fi]
                Denominator:[4x1 fi]

Now realize the model implementation.

realizemdl(hq,'optimizezeros','on',... 
'blockname','newfiltermodel');

Since this example uses the optional property name optimizezeros, set to 'on', the resulting block subsystem is slightly different — the zero-gain blocks for coefficients a(2) and a(4) are not included in the subsystem.

See Also

realizemdl under the methods for dfilt in Signal Processing Toolbox documentation

  


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