Notch-Peak Filter
The project of notch and narrowband IIR filters of the second order with adjustable parameters.
blockType: NotchPeakFilter
Path in the library:
|
Description
Block Notch-Peak Filter Filters each channel of the input signal by time, using a predetermined center frequency and a bandwidth of 3 dB. This block offers customizable filter design parameters that allow you to customize the filter characteristics during simulation execution. The block simulates the filter according to the parameters specified in the block settings window.
Ports
Output
#
notch
—
output signal after cutting
vector | the matrix
Details
The output signal after passing through the notch filter, returned as a vector or matrix.
Dependencies
To use this port, set the parameter Filter output meaning Notch and Peak or Notch.
| Data types |
|
| Complex numbers support |
No |
#
peak
—
output signal after narrowband filter
vector | the matrix
Details
The output signal after passing the narrowband filter, returned as a vector or matrix.
Dependencies
To use this port, set the parameter Filter output meaning Notch and Peak or Peak.
| Data types |
|
| Complex numbers support |
No |
Input
#
x
—
The input signal
vector | the matrix
Details
The input data for the block, specified as a vector or matrix. Each column of the input signal is considered as a separate channel. If the input signal is two—dimensional, then the first dimension is the channel length (or frame size), and the second dimension is the number of channels. If there is a one-dimensional signal at the input, it is interpreted as a single channel.
| Data types |
|
| Complex numbers support |
Yes |
#
BW
—
bandwidth 3 dB
positive scalar
Details
The bandwidth input port is 3 dB.
Dependencies
To use this port, set the parameter Filter specification meaning Bandwidth and center frequency and check the box Specify bandwidth from input port.
| Data types |
|
| Complex numbers support |
No |
#
Fc
—
central frequency
positive scalar
Details
The center frequency input port.
Dependencies
To use this port, set the parameter Filter specification meaning Bandwidth and center frequency or Quality factor and center frequency and check the box Specify center frequency from input port.
| Data types |
|
| Complex numbers support |
No |
#
BWCoeff
—
bandwidth factor
the real scalar
Details
The bandwidth factor input port.
The coefficient determining the bandwidth of 3 dB, set as a scalar in the range [−1, 1], where −1 corresponds to a maximum bandwidth of 3 dB (one-fourth of the sampling frequency of the input signal), and 1 — minimum bandwidth (0 Hz, i.e. frequency-independent filter).
Dependencies
To use this port, set the parameter Filter specification meaning Coefficients and check the box Specify bandwidth coefficient from input port.
| Data types |
|
| Complex numbers support |
No |
#
FcCoeff
—
The central frequency coefficient
the real scalar
Details
The input port of the coefficient determining the center frequency of the filter, in the form of a scalar in the range [−1, 1], where −1 corresponds to the minimum central frequency (0 Hz), and 1 — the maximum central frequency (half the sampling frequency of the input signal).
Dependencies
To use this port, set the parameter Filter specification meaning Coefficients and check the box Specify center frequency coefficient from input port.
| Data types |
|
| Complex numbers support |
No |
#
Q
—
the quality of a notch or narrowband filter
5 (by default) | positive scalar
Details
The Q-factor input port of a notch or narrowband filter in the form of a real positive scalar. The quality factor is defined as the ratio of the center frequency of a notch or narrowband filter and the bandwidth of 3 dB. A higher quality factor value corresponds to a smaller bandwidth of suppression and bandwidth.
Dependencies
To use this port, set the parameter Filter specification meaning Quality factor and center frequency and check the box Specify quality factor from input port.
| Data types |
|
| Complex numbers support |
No |
Parameters
Main
#
Filter specification —
characteristics of the filter project
Coefficients | Bandwidth and center frequency | Quality factor and center frequency
Details
Specify the parameter or coefficients that the block uses to design the filter.:
-
Bandwidth and center frequency— designing a filter using parameters 3 dB bandwidth (Hz) and Notch/Peak center frequency (Hz). -
Coefficients— designing a filter using parameters Bandwidth coefficient and Center frequency coefficient. -
Quality factor and center frequency— designing a filter using parameters Quality factor and Notch/Peak center frequency (Hz).
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Specify bandwidth coefficient from input port —
an option for setting the bandwidth factor via the input port
Logical
Details
If this option is selected, the bandwidth factor is set via the BWCoeff port. If the checkbox is unchecked, the bandwidth factor is set in the parameter Bandwidth coefficient.
Dependencies
To use this parameter, set for the parameter Filter specification meaning Coefficients.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Bandwidth coefficient —
bandwidth factor
Real number
Details
Specify the coefficient determining the bandwidth of 3 dB as a scalar in the range [−1, 1]:
-
−1— corresponds to a maximum bandwidth of 3 dB (one-fourth of the sampling frequency of the input signal); -
1— corresponds to the minimum bandwidth (0Hz, i.e. frequency-independent filter).
Dependencies
To use this parameter, set for the parameter Filter specification meaning Coefficients and uncheck the box Specify bandwidth coefficient from input port.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Specify center frequency coefficient from input port —
an option for setting the center frequency coefficient via the input port
Logical
Details
If this option is selected, the center frequency coefficient is set via the FcCoeff port. If the checkbox is unchecked, the center frequency coefficient is set in the parameter Center frequency coefficient.
Dependencies
To use this parameter, set for the parameter Filter specification meaning Coefficients.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Center frequency coefficient —
The central frequency coefficient
Real number
Details
Specify the coefficient that determines the center frequency of the filter as a scalar in the range [−1, 1]:
-
−1— corresponds to the minimum central frequency (0Hz); -
1— corresponds to the maximum center frequency (half of the sampling frequency of the input signal).
Dependencies
To use this parameter, set for the parameter Filter specification meaning Coefficients and uncheck the box Specify center frequency coefficient from input port.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Specify bandwidth from input port —
an option to set the bandwidth to 3 dB via the input port
Logical
Details
If this option is selected, the 3 dB bandwidth is set via the BW port. If the checkbox is unchecked, the 3 dB bandwidth is set in the parameter 3 dB bandwidth (Hz).
Dependencies
To use this parameter, set for the parameter Filter specification meaning Bandwidth and center frequency.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
3 dB bandwidth (Hz) —
bandwidth 3 dB
Real number
Details
Specify the bandwidth of the 3 dB filter as a positive scalar in Hz.
Dependencies
To use this port, set the parameter Filter specification meaning Bandwidth and center frequency and uncheck the box Specify bandwidth from input port.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Specify quality factor from input port —
an option for setting the quality factor via the input port
Logical
Details
If the flag is checked, the quality factor is set via the Q port. If the checkbox is unchecked, the quality factor is set in the parameter Quality factor.
Dependencies
To use this parameter, set for the parameter Filter specification meaning Quality factor and center frequency.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Quality factor —
the quality of a notch or narrowband filter
Real number
Details
Specify the quality factor of a notch or narrowband filter in the form of a real positive scalar. The quality factor is defined as the ratio of the center frequency of a notch or narrowband filter and the bandwidth of 3 dB. A higher quality factor value corresponds to a smaller bandwidth of suppression and bandwidth.
Dependencies
To use this parameter, set for the parameter Filter specification meaning Quality factor and center frequency and uncheck the box Specify quality factor from input port.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Specify center frequency from input port —
an option for setting the center frequency via the input port
Logical
Details
If the flag is checked, the center frequency is set via the Fc port. If the checkbox is unchecked, the center frequency is set in the parameter Notch/Peak center frequency (Hz).
Dependencies
To use this parameter, set for the parameter Filter specification meaning Bandwidth and center frequency or Quality factor and center frequency.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Notch/Peak center frequency (Hz) —
the center frequency of a notch or narrowband filter
Real number
Details
The value of the center frequency of a notch or narrowband filter in the form of a positive scalar in Hz.
Dependencies
To use this port, set the parameter Filter specification meaning Bandwidth and center frequency or Quality factor and center frequency and uncheck the box Specify bandwidth from input port.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
#
Filter output —
selecting a filter for data output
Notch | Peak | Notch and Peak
Details
Selecting the output data:
-
Notch and Peak— the unit outputs the output signal after passing the notch and narrowband filters. -
Notch— the unit outputs the output signal after passing the notch filter. -
Peak— The unit outputs an output signal after passing a narrowband filter.
| Values |
|
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Inherit sample rate from input —
inherit the sampling rate from the input signal
Logical
Details
If this option is selected, the sampling rate is inherited from the input signal. If the checkbox is unchecked, the sampling frequency is set in the parameter Input sample rate (Hz).
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
No |
#
Input sample rate (Hz) —
Sampling rate of the input signal
Real number
Details
Specify the sampling frequency of the input signal as a positive scalar value.
Dependencies
To use this option, uncheck the box. Inherit sample rate from input.
| Default value |
|
| Program usage name |
|
| Tunable |
No |
| Evaluatable |
Yes |
Algorithms
The equation for the narrowband filter project is as follows:
The equation for the injection filter project is as follows:
In these equations
Where — the central frequency in Hz, — sampling rate in Hz, — bandwidth of 3 dB per Hz.
Note that these two filters complement each other:
They can be rewritten as
Where — frequency-independent second-order filter:
The filter is implemented as follows:
In the picture:
Note that depends only on the center frequency, and — only from a bandwidth of 3 dB.