Main Content

dsp.VariableBandwidthIIRFilter

Variable bandwidth IIR filter

Description

The dsp.VariableBandwidthIIRFilter object filters each channel of the input using IIR filter implementations. It does so while having the capability of tuning the bandwidth.

To filter each channel of the input:

  1. Create the dsp.VariableBandwidthIIRFilter object and set its properties.

  2. Call the object with arguments, as if it were a function.

To learn more about how System objects work, see What Are System Objects?

Creation

Description

vbwIIR = dsp.VariableBandwidthIIRFilter returns a variable bandwidth IIR filter object which independently which independently filters each channel of the input over successive calls to the algorithm. This System object™ uses a specified IIR filter implementation. The filter passband frequency can be tuned during the filtering operation. The variable bandwidth IIR filter is designed using the elliptical method. The filter is tuned using IIR spectral transformations based on allpass filters.

vbwIIR = dsp.VariableBandwidthIIRFilter(Name=Value) returns a variable bandwidth IIR filter with additional properties specified by one or more Name=Value pair arguments. Name is the property name and Value is the corresponding value. For example, PassbandFrequency=512 sets the passband frequency to 512 Hz.

example

Properties

expand all

Unless otherwise indicated, properties are nontunable, which means you cannot change their values after calling the object. Objects lock when you call them, and the release function unlocks them.

If a property is tunable, you can change its value at any time.

For more information on changing property values, see System Design in MATLAB Using System Objects.

Type of filter response, specified as one of these options:

  • 'Lowpass'

  • 'Highpass'

  • 'Bandpass'

  • 'Bandstop'

IIR filter order, specified as a positive integer.

Data Types: double | single

Filter passband frequency, specified as a positive scalar in Hz or in normalized frequency units (since R2023a).

If you set the NormalizedFrequency property to:

  • false –– The value of the passband frequency is in Hz. The value must be less than half the SampleRate property value.

  • true –– The value of the passband frequency is in normalized frequency units. The value must be a positive scalar less than 1.0.

(since R2023a)

Tunable: Yes

Dependencies

To enable this property, set the FilterType property to 'Lowpass' or 'Highpass'.

Data Types: double | single

Filter center frequency, specified as a real positive scalar in Hz or in normalized frequency units (since R2023a).

If you set the NormalizedFrequency property to:

  • false –– The value of the center frequency is in Hz. The value must be less than half the SampleRate property value.

  • true –– The value of the center frequency is in normalized frequency units. The value must be a positive scalar less than 1.0.

(since R2023a)

Tunable: Yes

Dependencies

To enable this property, set the FilterType property to 'Bandpass' or 'Bandstop'.

Data Types: double | single

Filter bandwidth, specified as a real positive scalar in Hz or in normalized frequency units (since R2023a).

If you set the NormalizedFrequency property to:

  • false –– The value of the filter bandwidth is in Hz. The value must be less than half the SampleRate property value.

  • true –– The value of the filter bandwidth is in normalized frequency units. The value must be a positive scalar less than 1.0.

(since R2023a)

Tunable: Yes

Dependencies

To enable this property, set the FilterType property to 'Bandpass' or 'Bandstop'.

Data Types: double | single

Filter passband ripple, specified as a real positive scalar in dB.

Data Types: double | single

Filter stopband attenuation, specified as a real positive scalar in dB.

Data Types: double | single

Since R2023a

When you set this property to:

  • true –– The filter passband frequency, center frequency, and the filter bandwidth must be in the normalized frequency units and less than 1.0.

  • false –– The filter passband frequency, center frequency, and the filter bandwidth are in Hz. You can specify the input sample rate through the SampleRate property.

Data Types: logical

Input sample rate, specified as a positive scalar in Hz.

Dependency

To enable this property, set NormalizedFrequency to false. (since R2023a)

Data Types: double | single

Usage

Description

y = vbwIIR(x) filters the real or complex input signal x using a variable bandwidth IIR filter to produce the output y. The variable bandwidth IIR filter object operates on each channel, which means the object filters every column of the input signal independently over successive calls to the algorithm.

example

Input Arguments

expand all

Data input, specified as a vector or a matrix. This object also accepts variable-size inputs. Once the object is locked, you can change the size of each input channel, but you cannot change the number of channels.

Data Types: double | single
Complex Number Support: Yes

Output Arguments

expand all

Filtered output, returned as a vector or a matrix. The size, data type, and complexity of the output signal matches that of the input signal.

Data Types: double | single
Complex Number Support: Yes

Object Functions

To use an object function, specify the System object as the first input argument. For example, to release system resources of a System object named obj, use this syntax:

release(obj)

expand all

freqzFrequency response of discrete-time filter System object
filterAnalyzerAnalyze filters with Filter Analyzer app
impzImpulse response of discrete-time filter System object
infoInformation about filter System object
coeffsReturns the filter System object coefficients in a structure
costEstimate cost of implementing filter System object
grpdelayGroup delay response of discrete-time filter System object
outputDelayDetermine output delay of single-rate or multirate filter
stepRun System object algorithm
releaseRelease resources and allow changes to System object property values and input characteristics
resetReset internal states of System object

Examples

collapse all

Tune the center frequency and the bandwidth of the IIR bandpass filter. Filter a sinusoidal signal through this filter.

Define a bandpass variable bandwidth IIR filter. Specify an input sample rate of 44100 Hz. Initialize a dsp.TransferFunctionEstimator object to estimate the transfer function of the filter from the input and output signals. To visualize the transfer function, initialize a dsp.ArrayPlot object.

Fs = 44100; 
vbwiir = dsp.VariableBandwidthIIRFilter(FilterType='Bandpass',...
    FilterOrder=8,...
    SampleRate=Fs,...
    CenterFrequency=1e4,...
    Bandwidth=4e3);
tfe = dsp.TransferFunctionEstimator(FrequencyRange='onesided');
aplot = dsp.ArrayPlot(PlotType='Line',...
    XOffset=0,...
    YLimits=[-120 5], ...
    SampleIncrement=44100/1024,...
    YLabel='Frequency Response (dB)',...
    XLabel='Frequency (Hz)',...
    Title='System Transfer Function');

Generate a sine wave signal with a frame length of 1024. Tune the bandwidth and the center frequency of the filter. Pass the signal through this filter. Estimate the transfer function of the filter using the input and the generated output. Plot the system transfer function on Array Plot.

FrameLength = 1024;
sine = dsp.SineWave(SamplesPerFrame=FrameLength);
for i = 1:500
    % Generate input
    x = sine() + randn(FrameLength,1);
    % Pass input through the filter
    y = vbwiir(x);
    % Transfer function estimation
    h = tfe(x,y);
    % plot transfer function
    aplot(20*log10(abs(h)))
    % Tune bandwidth and center frequency of the IIR filter
    if (i==250)
        vbwiir.CenterFrequency = 5000;
        vbwiir.Bandwidth = 2000;
    end
end

Algorithms

This filter covers frequency transformations. The algorithm designs a lowpass IIR prototype using the elliptical method by specifying its order, passband frequency, passband ripple, and stopband attenuation. The passband ripple and stopband attenuation are equal to the values of the PassbandRipple and StopbandAttenuation properties. The algorithm sets the prototype passband frequency to 0.5. If the FilterType property is 'Lowpass' or 'Highpass', the order of the prototype filter is equal to the value of FilterOrder. If the FilterType property is 'Bandpass' or 'Bandstop', the order of the prototype filter is equal to FilterOrder/2. The prototype is a Direct Form II Transposed cascade of second-order sections (Biquad filter). The prototype is transformed into the desired filter using the algorithms used in Digital Frequency Transformations. Each prototype SOS section is transformed separately. When FilterType is 'Lowpass' or 'Highpass', the resulting filter remains a Direct Form II Transposed cascade of second order sections. If the FilterType is 'Bandpass' or 'Bandstop', the resulting filter is a cascade of Direct Form II Transposed cascade of fourth order sections.

References

[1] A. G. Constantinides. “Spectral transformations for digital filters”, Proc. Inst. Elect. Eng. Vol. 117, No. 8, 1970, pp. 1585-1590.

Extended Capabilities

Version History

Introduced in R2014a

expand all