Second-order tunable notching and peaking IIR filter
NotchPeakFilter object filters each channel
of the input using IIR filter implementation.
To filter each channel of the input:
Define and set up your NotchPeak filter. See Construction.
step to filter each channel
of the input according to the properties of
The behavior of
step is specific to each object in
Starting in R2016b, instead of using the
H = dsp.NotchPeakFilter returns
a second-order notching and peaking IIR filter which independently
filters each channel of the input over time, using a specified center
frequency and 3 dB bandwidth. Both of these properties are specified
in Hz and are tunable. Both of these values must be scalars between
half the sample rate.
H = dsp.NotchPeakFilter(' returns a notch filter with each specified property
name set to the specified value. You can specify additional name-value
pair arguments in any order as
H = dsp.NotchPeakFilter('specification','Quality factor
and center frequency') specifies the quality factor (Q
factor) of the notch or peak filter instead of the
bandwidth. The Q factor is defined as the center frequency divided
by the bandwidth. A higher Q factor corresponds to a narrower notch
or peak. The Q factor should be a scalar value greater than 0. The
Q factor is tunable.
H = dsp.NotchPeakFilter('Specification','Coefficients') specifies
the coefficient values that affect bandwidth and center frequency
directly, rather than specifying the design parameters in Hz. This
removes the trigonometry calculations involved when the properties
are tuned. The
be a scalar between
-1 corresponding to
1 corresponding to the Nyquist frequency. The
be a scalar between
-1 corresponding to the largest
1 corresponding to the smallest
bandwidth. Both coefficient values are tunable.
Set the specification as one of
3 dB bandwidth
Specify the filter's
Notch or Peak center frequency
Specify the filter's center frequency (for both the notch
and the peak) as a finite positive numeric scalar in Hertz. This property
is applicable only if
Quality factor for notch or peak filter
Specify the quality factor (Q factor) for both the notch and
the peak filters. The Q factor is defined as the center frequency
divided by the bandwidth. This property is applicable only if
Sample rate of input
Specify the sample rate of the input in Hertz as a finite numeric
scalar. The default is
Specify the value that determines the filter's
Center frequency coefficient
Specify the coefficient that determines the filter's
center frequency as a finite numeric scalar between
|clone||Create System object with same property values|
|getBandwidth||Get 3 dB bandwidth|
|getCenterFrequency||Get center frequency|
|getOctaveBandwidth||Bandwidth in number of octaves|
|getQualityFactor||Get quality factor|
|isLocked||Locked status for input attributes and nontunable properties|
|release||Allow property value and input characteristics changes|
|reset||Reset the internal states of notch or peak filter|
|step||Process input using the notch or peak filter algorithm|
This example shows how to use dsp.NotchPeakFilter as a notch filter with center frequency of 5000 Hz and a 3 dB bandwidth of 500 Hz.
Note: This example runs only in R2016b or later. If you are using an earlier release, replace each call to the function with the equivalent
step syntax. For example, myObject(x) becomes step(myObject,x).
h = dsp.NotchPeakFilter('CenterFrequency',5000,'Bandwidth',500); hscope = dsp.SpectrumAnalyzer('SampleRate',44100,... 'PlotAsTwoSidedSpectrum',false,'SpectralAverages',50); for i=1:5000 y = h(randn(1024,1)); hscope(y); if (i==2500) % Tune center frequency to 10000 h.CenterFrequency = 10000; end end release(h) release(hscope)
The design equations for this filter are:
The previous equation is for peak filter, and the following equation is for notch filter.
where ω0 = 2πf0/fs is the center frequency in radians/sample (f0 is the center frequency in Hz and fs is the sampling frequency in Hz). Δω = 2πΔf/fs is the 3 dB bandwidth in radians/sample (Δf is the 3 dB bandwidth in Hz). Note that the two filters are complementary:
The filter is implemented as follows:
Notice that Gcf depends only on the center frequency, and G3dB depends only on the 3 dB bandwidth.
 Orfanidis, Sophocles J. Introduction to Signal Processing. Upper Saddle River, NJ: Prentice-Hall, 1996.