Main Content

Notch-Peak Filter

Design second-order tunable notching and peaking IIR filter

Library

Filtering / Filter Designs

dspfdesign

  • Notch-Peak Filter block

Description

The Notch-Peak Filter block filters each channel of the input signal over time using a specified center frequency and 3 dB bandwidth. This block offers tunable filter design parameters, which enable you to tune the filter characteristics while the simulation is running.

The block designs the filter according to the filter parameters set in the block dialog box. The output port properties such as datatype, complexity, and dimension, are identical to the input port properties.

Each column of the input signal is treated as a separate channel. If the input is a two-dimensional signal, the first dimension represents the channel length (or frame size) and the second dimension represents the number of channels. If the input is a one-dimensional signal, then it is interpreted as a single channel.

This block supports variable-size input, enabling you to change the channel length during simulation. To enable variable-size input, clear the Inherit sample rate from input check box. The number of channels must remain constant.

Algorithms

This block brings the capabilities of the dsp.NotchPeakFilter System object™ to the Simulink® environment.

The filter uses a coupled allpass structure to optimize joint computation of the peak and notch response. For information on the algorithms used by the Notch-Peak filter block, see the Algorithms section of dsp.NotchPeakFilter.

Parameters

Filter specification

Parameters or coefficients used to design the filter, specified as one of the following:

  • Bandwidth and center frequency (default) — Design the filter using 3 dB bandwidth (Hz) and Notch/Peak center frequency (Hz).

  • Coefficients — Design the filter using Bandwidth coefficient and Center frequency coefficient.

  • Quality factor and center frequency — Design the filter using Quality factor and Notch/Peak center frequency (Hz).

This parameter is nontunable.

Specify bandwidth from input port

When you select this check box, the 3 dB bandwidth is input through the BW port. When you clear this check box, the 3 dB bandwidth is specified on the block dialog through the 3 dB bandwidth (Hz) parameter.

This parameter applies when you set Filter specification to Bandwidth and center frequency.

3 dB bandwidth (Hz)

3 dB bandwidth of the filter, specified as a finite positive numeric scalar that is less than half the sample rate of the input signal. This parameter applies when you set Filter specification to Bandwidth and center frequency, and clear the Specify bandwidth from input port parameter. The default is 2205. This parameter is tunable.

Specify center frequency from input port

When you select this check box, the center frequency is input through the Fc port. When you clear this check box, the center frequency is specified on the block dialog through the Notch/Peak center frequency (Hz) parameter.

This parameter applies when you set Filter specification to Bandwidth and center frequency or Quality factor and center frequency.

Notch/Peak center frequency (Hz)

Center frequency of the notch and peak of the filter, specified as a finite positive numeric scalar that is less than half the sample rate of the input signal. This parameter applies when you set Filter specification to Bandwidth and center frequency or Quality factor and center frequency, and clear the Specify center frequency from input port parameter. The default is 11025. This parameter is tunable.

Specify bandwidth coefficient from input port

When you select this check box, the bandwidth coefficient is input through the port, BWCoeff. When you clear this check box, the bandwidth coefficient is specified on the block dialog through the Bandwidth coefficient parameter.

This parameter applies when you set Filter specification to Coefficients.

Bandwidth coefficient

Coefficient that determines the 3 dB bandwidth of the filter, specified as a finite numeric scalar in the range [-1 1].

  • -1 corresponds to the maximum 3 dB bandwidth (one-fourth the sample rate of the input signal).

  • 1 corresponds to the minimum bandwidth (0 Hz, that is, an allpass filter).

This parameter applies when you set Filter specification to Coefficients and clear the Specify bandwidth coefficient from input port parameter. The default is 0.72654. This parameter is tunable.

Specify center frequency coefficient from input port

When you select this check box, the center frequency coefficient is input through the FcCoeff port. When you clear this check box, the center frequency coefficient is specified on the block dialog through the Center frequency coefficient parameter.

This parameter applies when you set Filter specification to Coefficients.

Center frequency coefficient

Coefficient that determines the center frequency of the filter, specified as a finite numeric scalar in the range [-1 1].

  • -1 corresponds to the minimum center frequency (0 Hz).

  • 1 corresponds to the maximum center frequency (half the sample rate of the input signal).

This parameter applies when you set Filter specification to Coefficients and clear the Specify center frequency coefficient from input port parameter. The default is 0, which corresponds to quarter the sample rate of the input signal. This parameter is tunable.

Specify quality factor from input port

When you select this check box, the quality factor is input through the Q port. When you clear this check box, the quality factor is specified on the block dialog through the Quality factor parameter.

This parameter applies when you set Filter specification to Quality factor and center frequency.

Quality factor

Quality factor of the notch and peak filter, specified as a real positive scalar. The quality factor is defined as Notch/Peak center frequency (Hz) / 3 dB bandwidth (Hz). A higher quality factor corresponds to a narrower peak or dip. This parameter applies when you set Filter specification to Quality factor and center frequency and clear the Specify quality factor from input port parameter. The default is 5. This parameter is tunable.

Output

Output of the filter block, specified as one of the following:

  • Notch and Peak (default) — The block outputs the notch and peak responses of the filter.

  • Notch — The block outputs the notch response of the filter.

  • Peak — The block outputs the peak response of the filter.

This parameter is nontunable.

Inherit sample rate from input

When you select this check box, the block sample rate is computed as N/Ts, where N is the frame size of the input signal, and Ts is the sample time of the input signal. When you clear this check box, the block’s sample rate is the value specified in Input sample rate (Hz). By default, this check box is selected.

Input sample rate (Hz)

Sample rate of the input signal, specified as a positive scalar value. The default is 44100. This parameter applies when you clear the Inherit sample rate from input check box. This parameter is nontunable.

View Filter Response

Opens the Dynamic Filter Visualizer window and displays the magnitude and phase response of the notch-peak filter. The response is based on the parameters you select in the Block Parameters dialog box. To update the response while the visualizer is running, modify the parameters in the dialog box and click Apply.

You can configure the plot settings and the frequency response measurements from the interface of the visualizer.

On the Plot tab, you can enable the legend, specify to plot both magnitude and phase responses of the filter, modify the plot settings, generate a script to re-create the plot, and even save or share the settings.

On the Measurements tab, you can enable data cursors, and display the peak values of the filter response.

For more details on the Dynamic Filter Visualizer interface and its tools, see Configure Filter Visualizer.

Simulate using

Type of simulation to run. You can set this parameter to:

  • Code generation (default)

    Simulate model using generated C code. The first time you run a simulation, Simulink generates C code for the block. The C code is reused for subsequent simulations, as long as the model does not change. This option requires additional startup time but provides faster simulation speed than Interpreted execution.

  • Interpreted execution

    Simulate model using the MATLAB®  interpreter. This option shortens startup time but has slower simulation speed than Code generation.

Supported Data Types

PortSupported Data Types

Input

  • Double-precision floating point

  • Single-precision floating point

Output

  • Double-precision floating point

  • Single-precision floating point

References

[1] Orfanidis, Sophocles J. Introduction to Signal Processing. Upper Saddle River, NJ: Prentice-Hall, 1996.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.

Version History

Introduced in R2015a