Documentation Center 
Simulink subsystem block for filter
realizemdl(hq)
realizemdl(hq,Name,Value)
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 FixedPoint.
realizemdl(hq,Name,Value) generates the model for hq with additional options specified by one or more Name,Value pair arguments. Using namevalue 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.
hq 
One of the following types of filter object or filter System object™:

'Destination' 
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' 
Provide the name for the new subsystem block. By default the block is named Filter. 
'MapCoeffstoPorts' 
Specify whether to map the coefficients of the filter to the ports of the block. 
'MapStates' 
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' 
Specify whether to overwrite an existing block with the same name or create a new block. 
'OptimizeZeros' 
Specify whether to remove zerogain blocks. 
'OptimizeOnes' 
Specify whether to replace unitygain blocks with direct connections. 
'OptimizeNegOnes' 
Specify whether to replace negative unitygain blocks with a sign change at the nearest sum block. 
'OptimizeDelayChains' 
Specify whether to replace delay chains made up of n unit delays with a single delay by n. 
'CoeffNames' 
Specify the coefficient variable names as string variables in a cell array. MapCoeffsToPorts must be set to 'on' for this property to apply. 
'InputProcessing' 
Specify samplebased ('elements as channels') or framebased ('columns as channels') processing. 
'RateOption' 
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' 
For filter System object inputs only, specify the arithmetic used during analysis. When you specify 'double' or 'single', the function performs double or singleprecision analysis. When you specify 'fixed' , the arithmetic changes depending on the setting of the CoefficientDataType property and whether the System object is locked or unlocked. Details for FixedPoint Arithmetic When you do not specify the arithmetic for nonCIC structures, the function uses doubleprecision arithmetic if the filter System object is in an unlocked state. If the System object is locked, the function performs analysis based on the locked input data type. CIC structures only support fixedpoint arithmetic. 
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:
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 secondorder 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 secondorder section. You can modify the filter coefficients directly in the MATLAB workspace providing tunability to the realized Simulink model.