Main Content

# Filter Designer

Design filters starting with algorithm selection

## Description

The Filter Designer app enables you to design and analyze digital filters. You can also import and modify existing filter designs.

Using the app, you can:

• Choose a response type and filter design method

• Set filter design specifications

• Analyze, edit, and optimize a filter design

• Export a filter design or generate MATLAB® code

For more information, see Introduction to Filter Designer.

If the DSP System Toolbox™ product is installed, Filter Designer integrates advanced filter design methods and the ability to quantize filters. For more information, see `filterDesigner` (DSP System Toolbox).

Note

This app requires a screen resolution greater than 640 × 480.

## Open the Filter Designer App

• MATLAB Toolstrip: On the Apps tab, under Signal Processing and Communications, click the app icon.

• Enter `filterDesigner` in the MATLAB command prompt.

## Examples

expand all

Use the Filter Designer app to create a 50th-order equiripple FIR bandpass filter to be used with signals sampled at 1 kHz.

```N = 50; Fs = 1e3;```

Specify that the passband spans frequencies of 200–300 Hz and that the transition region on either side has a width of 50 Hz.

```Fstop1 = 150; Fpass1 = 200; Fpass2 = 300; Fstop2 = 350;```

Specify weights for the optimization fit:

• 3 for the low-frequency stopband

• 1 for the passband

• 100 for the high-frequency stopband

Open the Filter Designer app.

```Wstop1 = 3; Wpass = 1; Wstop2 = 100; filterDesigner```

Use the app to design the rest of the filter. To specify the frequency constraints and magnitude specifications, use the variables you created.

1. Set Response Type to `Bandpass`.

2. Set Design Method to `FIR`. From the drop-down list, select `Equiripple`.

3. Under Filter Order, specify the order as `N`.

4. Under Frequency Specifications, specify Fs as `Fs`.

5. Click Design Filter. Design an FIR filter with the following piecewise frequency response:

• A sinusoid between 0 and 0.19π rad/sample.

```F1 = 0:0.01:0.19; A1 = 0.5+sin(2*pi*7.5*F1)/4;```
• A piecewise linear section between 0.2π rad/sample and 0.78π rad/sample.

```F2 = [0.2 0.38 0.4 0.55 0.562 0.585 0.6 0.78]; A2 = [0.5 2.3 1 1 -0.2 -0.2 1 1];```

• A quadratic section between 0.79π rad/sample and the Nyquist frequency.

```F3 = 0.79:0.01:1; A3 = 0.2+18*(1-F3).^2;```

Specify a filter order of 50. Consolidate the frequency and amplitude vectors. To give all bands equal weights during the optimization fit, specify a weight vector of all ones. Open the Filter Designer app.

```N = 50; FreqVect = [F1 F2 F3]; AmplVect = [A1 A2 A3]; WghtVect = ones(1,N/2); filterDesigner```

Use the app to design the filter.

1. Under Response Type, select the button next to `Differentiator`. From the drop-down list, choose ```Arbitrary Magnitude```.

2. Set Design Method to `FIR`. From the drop-down list, select `Least-squares`.

3. Under Filter Order, specify the order as the variable `N`.

4. Under Frequency and Magnitude Specifications, specify the variables you created:

• Freq. vector`FreqVect`.

• Mag. vector`AmplVect`.

• Weight vector`WghtVect`.

5. Click Design Filter.

6. Right-click the y-axis of the plot and select Magnitude to express the magnitude response in linear units. ## See Also

### Functions

Introduced before R2006a

## Support

#### Deep Learning for Signal Processing with MATLAB

Download white paper