Products & Services Solutions Academia Support User Community Company

Learn more about Filter Design Toolbox   

Realizing Filters as Simulink Subsystem Blocks

Introduction

After you design or import a filter in FDATool, the realize model feature lets you create a Simulink subsystem block that implements your filter. The generated filter subsystem block uses either the Digital Filter block or the delay, gain, and sum blocks in Simulink. If you do not own Simulink® Fixed Point™software, FDATool still realizes your model using blocks in fixed-point mode from Simulink, but you cannot run any model that includes your filter subsystem block in Simulink.

About the Realize Model Panel in FDATool

Switching FDATool to realize model mode, by clicking on the sidebar, gives you access to the Realize Model panel and the options for realizing your quantized filter as a Simulink subsystem block.

On the panel, as shown here, are the options provided for configuring how FDATool realizes your model.

Model Options

Under Model, you set options that direct FDATool where to put your new subsystem block and what to name the block.

Destination.   Tells FDATool whether to put the new block in your current Simulink model or open a new Simulink model and add the block to that window. Select Current model to add the block to your current model, or select New model to create a new model for the block.

Block name.   Provides FDATool with a name to assign to your block. When you realize your filter as a subsystem, the resulting block shows the name you enter here as the block name, positioned below the block.

Overwrite block.   Directs FDATool whether to overwrite an existing block with this block in the destination model. The result is that the new filter realization subsystem block replaces the existing filter subsystem block. Selecting this option replaces your existing filter realization subsystem block with the one you create when you click Realize Model. Clearing Overwrite block causes FDATool to create a new block in the destination model, rather than replacing the existing block.

Build block using basic elements.   You can determine how FDATool models the specified filter using this check box. When you select this check box, FDATool creates a subsystem block that implements your filter using Sum, Gain, and Delay blocks. When you clear this check box, FDATool uses a Digital Filter block to implement your filter. Filters that you realize with the Digital Filter block accept sample-based, vector, or frame-based input.

The Build model using basic elements check box is available only when your filter can be implemented using a Digital Filter block.

Optimization Options

Four options enable you to tailor the way the realized model optimizes various filter features such as delays and gains. When you open the Realize Model panel, these options are selected by default.

Optimize for zero gains.   Specify whether to remove zero-gain blocks from the realized filter.

Optimize for unity gains.   Specify whether to replace unity-gain blocks with direct connections in the filter subsystem.

Optimize for -1 gains.   Specify whether to replace negative unity-gain blocks with a sign change at the nearest sum block in the filter.

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

Each of these options can optimize the way your filter performs in simulation and in code you might generate from your model.

Example — Realize a Filter Using FDATool

After your quantized filter in FDATool is performing the way you want, with your desired phase and magnitude response, and with the right coefficients and form, follow these steps to realize your filter as a subsystem that you can use in a Simulink model.

  1. Click Realize Model on the sidebar to change FDATool to realize model mode.

  2. From the Destination list under Model, select either:

    • Current model — to add the realized filter subsystem to your current model

    • New model — to open a new Simulink model window and add your filter subsystem to the new window

  3. Provide a name for your new filter subsystem in the Name field.

  4. Decide whether to overwrite an existing block with this new one, and select or clear Overwrite block to direct FDATool which way to go — overwrite or not.

  5. Select Fixed-point blocks from the list in Block Type.

  6. Select or clear the optimizations to apply.

    • Optimize for zero gains — removes zero gain blocks from the model realization

    • Optimize for unity gains — replaces unity gain blocks with direct connections to adjacent blocks

    • Optimize for -1 gains — replaces negative gain blocks by a change of sign at the nearest sum block

    • Optimize delay chains — replaces cascaded delay blocks with a single delay block that produces the equivalent gain

  7. Click Realize Model to realize your quantized filter as a subsystem block according to the settings you selected.

If you double-click the filter block subsystem created by FDATool, you see the filter implementation in Simulink model form. Depending on the options you chose when you realized your filter, and the filter you started with, you might see one or more sections, or different architectures based on the form of your quantized filter. From this point on, the subsystem filter block acts like any other block that you use in Simulink models.

Supported Filter Structures

FDATool lets you realize discrete-time and multirate filters from the following forms:

Structure

Description

firdecim

Decimators based on FIR filters

firtdecim

Decimators based on transposed FIR filters

linearinterp

Linear interpolators

firinterp

Interpolators based on FIR filters

multirate polyphase

Multirate filters

holdinterp

Interpolators that use the hold interpolation algorithm

dfilt.allpass

Discrete-time filters with allpass structure

dfilt.cascadeallpass

 

dfilt.cascadewdfallpass

 

mfilt.iirdecim

Decimators based on IIR filters

mfilt.iirwdfdecim

 

mfilt.iirinterp

Interpolators based on IIR filters

mfilt.iirwdfinterp

 

dfilt.wdfallpass

 

  


Free Early Verification Kit

Learn how to apply early verification to your development process through these technical resources.

How much time do you spend on testing to ensure implementation meets system-level requirements?

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