Main Content

realizemdl

Simulink subsystem block for filter

Description

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

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

realizemdl(sysobj,Name=Value) generates the model for sysobj 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.

example

Examples

collapse all

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

  dsp.SOSFilter with properties:

            Structure: 'Direct form II'
    CoefficientSource: 'Property'
            Numerator: [2x3 double]
          Denominator: [2x3 double]
       HasScaleValues: true
          ScaleValues: [0.1153 0.0886 1]

  Use get to show all properties

Create a new model, LPFilter.slx, and realize the subsystem block in this model.

new_system('LPFilter');
realizemdl(filterobject);

View the block diagram by clicking on the subsystem block.

Create a new model, LPFilterMapping.slx, and realize the subsystem block, with coefficients mapped to ports, in this model.

new_system('LPFilterMapping');
realizemdl(filterobject,MapCoeffsToPorts='on');

View the block diagram by clicking on the subsystem block.

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.

Input Arguments

collapse all

Name-Value Arguments

Example: d = fdesign.lowpass('N,F3dB',4,0.25); filterobject = design(d,'butter',Systemobject=true); realizemdl(filterobject,MapCoeffsToPorts='on');

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 as a character vector or a string scalar, the realizemdl function adds the new block to the specified subsystem.

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

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

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.

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

Specify whether to remove zero-gain blocks.

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

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

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

Specify the coefficient variable name as a cell array of character vectors. MapCoeffsToPorts must be set to 'on' for this property to apply.

Specify sample-based ('elementsaschannels') or frame-based ('columnsaschannels') processing.

Specify how the block adjusts the rate at the output to accommodate the reduced number of samples.

Dependencies

This parameter applies only when InputProcessing is 'columnsaschannels'.

The arithmetic for System object inputs must be 'double' or 'single'.

Limitations

The destination must be a Simulink model. The function does not support a library file destination.

Version History

Introduced in R2011a

expand all

See Also

Functions