Filter Designer



Choosing a Response Type. To design a bandpass filter, select the radio button next to Bandpass in. Filter Design Using MATLAB. Digital filters are central to almost every signal processing system. Filters eliminate unwanted artifacts from signals to enhance their quality and prepare them for further processing. Digital filters are used in a variety of signal processing tasks including outlier and noise removal, waveform shaping, signal smoothing, and signal recovery.

This example shows how to use Filter Designer as a convenient alternative to the command-line filter design functions.

Filter Designer is a powerful graphical user interface (GUI) in Signal Processing Toolbox™ for designing and analyzing filters.

Filter Designer enables you to quickly design digital FIR or IIR filters by setting filter performance specifications, by importing filters from your MATLAB® workspace or by adding, moving, or deleting poles and zeros. Filter Designer also provides tools for analyzing filters, such as magnitude and phase response plots and pole-zero plots.

Getting Started

Type filterDesigner at the MATLAB command prompt:

>> filterDesigner

A Tip of the Day dialog displays with suggestions for using Filter Designer. Then, the GUI displays with a default filter.

The GUI has three main regions:

  • The Current Filter Information region

  • The Filter Display region and

  • The Design panel

The upper half of the GUI displays information on filter specifications and responses for the current filter. The Current Filter Information region, in the upper left, displays filter properties, namely the filter structure, order, number of sections used and whether the filter is stable or not. It also provides access to the Filter manager for working with multiple filters.

The Filter Display region, in the upper right, displays various filter responses, such as, magnitude response, group delay and filter coefficients.

The lower half of the GUI is the interactive portion of Filter Designer. The Design Panel, in the lower half is where you define your filter specifications. It controls what is displayed in the other two upper regions. Other panels can be displayed in the lower half by using the sidebar buttons.

The tool includes Context-sensitive help. You can right-click or click the What's This? button to get information on the different parts of the tool.

Designing a Filter

We will design a low pass filter that passes all frequencies less than or equal to 20% of the Nyquist frequency (half the sampling frequency) and attenuates frequencies greater than or equal to 50% of the Nyquist frequency. We will use an FIR Equiripple filter with these specifications:

  • Passband attenuation 1 dB

  • Stopband attenuation 80 dB

  • A passband frequency 0.2 [Normalized (0 to 1)]

  • A stopband frequency 0.5 [Normalized (0 to 1)]

To implement this design, we will use the following specifications:

1. Select Lowpass from the dropdown menu under Response Type and Equiripple under FIR Design Method. In general, when you change the Response Type or Design Method, the filter parameters and Filter Display region update automatically.

2. Select Specify order in the Filter Order area and enter 30.

3. The FIR Equiripple filter has a Density Factor option which controls the density of the frequency grid. Increasing the value creates a filter which more closely approximates an ideal equiripple filter, but more time is required as the computation increases. Leave this value at 20.

4. Select Normalized (0 to 1) in the Units pull down menu in the Frequency Specifications area.

5. Enter 0.2 for wpass and 0.5 for wstop in the Frequency Specifications area.

6. Wpass and Wstop, in the Magnitude Specifications area are positive weights, one per band, used during optimization in the FIR Equiripple filter. Leave these values at 1.

7. After setting the design specifications, click the Design Filter button at the bottom of the GUI to design the filter.

The magnitude response of the filter is displayed in the Filter Analysis area after the coefficients are computed.

Viewing other Analyses

Once you have designed the filter, you can view the following filter analyses in the display window by clicking any of the buttons on the toolbar:

In order from left to right, the buttons are

  • Magnitude response

  • Phase response

  • Magnitude and Phase responses

  • Group delay response

  • Phase delay response

  • Impulse response

  • Step response

  • Pole-zero plot

  • Filter Coefficients

  • Filter Information

Filter Designer

Changing Axes Units

You can change the x- or y-axis units by right-clicking the mouse on an axis label and selecting the desired units. The current units have a check mark.

Marking Data Points

In the Display region, you can click on any point in the plot to add a data marker, which displays the values at that point. Right-clicking on the data marker displays a menu where you can move, delete or adjust the appearance of the data markers.

Optimizing the Design

To minimize the cost of implementation of the filter, we will try to reduce the number of coefficients by using Minimum Order option in the design panel.

Change the selection in Filter Order to Minimum Order in the Design Region and leave the other parameters as they are.

Click the Design Filter button to design the new filter.

Designer

As you can see in the Current Filter Information area, the filter order decreased from 30 to 16, the number of ripples decreased and the transition width became wider. The passband and the stopband specifications still meet the design criteria.

Changing Analyses Parameters

By right-clicking on the plot and selecting Analysis Parameters, you can display a dialog box for changing analysis-specific parameters. (You can also select Analysis Parameters from the Analysis menu.)

Geo Filter Designer

Filter

To save the displayed parameters as the default values, click Save as Default. To restore the MATLAB-defined default values, click Restore Original Defaults.

Exporting the Filter

Once you are satisfied with your design, you can export your filter to the following destinations:

  • MATLAB workspace

  • MAT-file

  • Text-file

Select Export from the File menu.

When you choose to export to the MATLAB workspace or to a MAT-file, you can export the filter as coefficients. If a DSP System Toolbox™ is available you can also export your filter as a System object.

Generating a MATLAB File

Ti Filter Designer

Filter Designer allows you to generate MATLAB code to re-create your filter. This enables you to embed your design into existing code or automate the creation of your filters in a script.

Select Generate MATLAB code from the File menu, choose Filter Design Function and specify the filename in the Generate MATLAB code dialog box.

The following code was generated from the minimum order filter we designed above:

Filter Designer

Quantizing a Filter

If you have the DSP System Toolbox™ installed, the Set quantization parameters panel is available on the sidebar:

You can use this panel to quantize and analyze double-precision filters. With the DSP System Toolbox you can quantize from double-precision to single-precision. If you have the Fixed-Point Designer, you can quantize filters to fixed-point precision. Note that you cannot mix floating-point and fixed-point arithmetic in your filter.

Targets

The Targets menu of Filter Designer allows you to generate various types of code representing your filter. For example, you can generate C header files, XILINX coefficients(COE) files (with the DSP System Toolbox) and VHDL, Verilog along with test benches (with Filter Design HDL Coder™).

Additional Features

Filter Designer also integrates additional functionality from these other MathWorks™ products:

  • DSP System Toolbox- Adds advanced FIR and IIR design techniques (i.e. Filter transformations, Multirate filters) and generates equivalent block for the filter

  • Embedded Coder™- Generates, builds and deploys code for Texas Instruments C6000 processors.

  • Filter Design HDL Coder- Generates synthesizable VHDL or Verilog code for fixed-point filters

  • Simulink®- Generates filters from atomic Simulink blocks

See Also

Browse our portfolio of diverse selection tools, calculators, simulation tools and model libraries that aid the entire PCB design process

We provide a wide variety of design tools, models and simulators to help you with the board design process. Our portfolio helps you select the right IC, design the application BOM, analyze your design and even export it to your favorite CAD environment. To verify your design, we offer the PSpice® for TI design and simulation tool that includes an extensive library of simulation models for our products. With comprehensive tools such as WEBENCH® Power Designer, a power for processor selector, the Power Stage Designer™ software tool and an active filter designer, you can perform quick calculations and simulations to help you analyze and understand your design performance.

Power design tools

WEBENCH® Power Designer

Save time and prototype your switched-mode power supply (SMPS) designs quickly. Select the right power regulator, design an application circuit and generate a BOM, enable the analysis of a circuit, and export your design to your favorite CAD tools.

Power for processors

Get a jump start with recommendations for discrete point of load regulators and PMICs to power your chosen processor or FPGA. This tool gives you the freedom to pick the right regulator that suits your application requirements.

Power Stage Designer™ software tool

Deeply analyze voltage, current stresses and stability with the Power Stage Designer™ software tool. The tool supports the majority of power topologies, from buck (step-down) to phase-shifted full bridges.

Signal chain design tools

Filter designer

Design, optimize and simulate complete multistage active filter solutions within minutes.

Analog circuits

Analog circuits are combined together to create subsystems of complete designs.

Clock tree architect

Create and compare multi-chip, system-level clock trees to meet your design requirements.

Analysis & simulation tools

Models & simulators

Use our models and simulators to design faster. PSpice® for TI is a full-featured, design and simulation suite that helps evaluate analog circuits. Our PCB thermal calculator helps you estimate the thermal dissipation of components on your board.