This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

dsp.VariableBandwidthFIRFilter System object

Package: dsp

Variable bandwidth FIR filter


The VariableBandwidthFIRFilter object filters each channel of the input using FIR filter implementations. It does so while having the capability of tuning the bandwidth. This filter supports double and single precision inputs.

To filter each channel of the input:

  1. Define and set up your variable bandwidth FIR filter. See Construction.

  2. Call step to filter each channel of the input according to the properties of dsp.VariableBandwidthFIRFilter. The behavior of step is specific to each object in the toolbox.

    Note:   Starting in R2016b, instead of using the step method to perform the operation defined by the System object™, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.


HFIR = dsp.VariableBandwidthFIRFilter returns a System object, HFIR, which independently filters each channel of the input over successive calls to the step method. This System object uses a specified FIR filter implementation. The filter's cutoff frequency may be tuned during the filtering operation. The variable bandwidth FIR filter is designed using the window method.

HFIR = dsp.VariableBandwidthFIRFilter('PropertyName',PropertyValue, ...) returns a variable bandwidth FIR filter System object, HFIR, with each property set to the specified value. You can specify additional name-value pair arguments in any order as (Name1,Value1,...,NameN,ValueN).



Input sample rate

Specify the sampling rate of the input in Hertz as a finite numeric scalar. The default is 44.1 kHz. This property is non-tunable.


Filter type

Specify the type of the filter as one of 'Lowpass' | 'Highpass' | 'Bandpass' | 'Bandstop'. The default is 'Lowpass'. This property is non-tunable.


FIR filter order

Specify the order of the FIR filter as a positive integer scalar. The default is 30. This property is non-tunable.


Window function

Specify the window function used to design the FIR filter as one of 'Hann' | 'Hamming' | 'Chebyshev' | 'Kaiser'. The default is 'Hann'. This property is non-tunable.


Kaiser window parameter

Specify the Kaiser window parameter as a real scalar. This property applies when you set the window property to 'Kaiser'. The default is 0.5. This property is non-tunable.


Filter cutoff frequency

Specify the filter cutoff frequency in Hz as a real, positive scalar, smaller than the SampleRate/2. This property applies if you set the FilterType property to 'Lowpass' or 'Highpass'. The default is 512 Hz. This property is tunable.


Filter center frequency

Specify the filter center frequency in Hz as a real, positive scalar, smaller than SampleRate/2. This property applies when you set the FilterType property to 'Bandpass' or 'Bandstop'. The default is 11025 Hz. This property is tunable.


Filter bandwidth

Specify the filter bandwidth in Hertz as a real, positive scalar, smaller than SampleRate/2. This property applies if you set the FilterType property to 'Bandpass' or 'Bandstop'. The default is 7680 Hz. This property is tunable.


Chebyshev window sidelobe attenuation

Specify the Chebyshev window attenuation as a real, positive scalar in decibels (dB). This property applies if you set the Window property to 'Chebyshev'. The default is 60 dB. This property is non-tunable.


cloneCreate variable bandwidth FIR filter with same property values
isLockedLocked status for input attributes and nontunable properties
releaseAllow property value and input characteristics changes
resetReset internal states of variable bandwidth FIR filter
stepFilter signal using variable bandwidth algorithm

More Analysis Methods for Filter System Objects.


expand all

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).

This example shows you how to tune the center frequency and the bandwidth of the FIR filter.

Fs = 44100; % Input sample rate
% Define a bandpass variable bandwidth FIR filter:
hfir = dsp.VariableBandwidthFIRFilter('FilterType','Bandpass',...
htfe = dsp.TransferFunctionEstimator('FrequencyRange','onesided');
hplot = dsp.ArrayPlot('PlotType','Line',...
    'YLimits',[-120 5], ...
    'SampleIncrement', 44100/1024,...
    'YLabel','Frequency Response (dB)',...
    'XLabel','Frequency (Hz)',...
    'Title','System Transfer Function');
FrameLength = 1024;
hsin = dsp.SineWave('SamplesPerFrame',FrameLength);
for i=1:500
    % Generate input
    x = hsin() + randn(FrameLength,1);
    % Pass input through the filter
    y = hfir(x);
    % Transfer function estimation
    h = htfe(x,y);
    % Plot transfer function
    % Tune bandwidth and center frequency of the FIR filter
    if (i==250)
        hfir.CenterFrequency = 5000;
        hfir.Bandwidth = 2000;


FIR Transformations

All transformations assume a lowpass filter of length 2N+1.

Lowpass to Lowpass

Consider an ideal lowpass brickwall filter with normalized cutoff frequency ωc1. By taking the inverse Discrete Fourier Transform of the ideal frequency response, and clipping the resulting sequence to length 2N+1, the impulse response is:

for n=0hLP(n)=ωcπ.w(0)for 1|n|NhLP(n)=sin(ωcn)πn.w(n)

where w(n) is the window vector. The lowpass filter coefficients are tuned to a new cutoff frequency ωc2 as follows:

for n=0hLP(n)=ωc2π.ω(0)for 1  |n|  NhLP(n)=sin(ωc2n)πn.ω(n)

There is no need to recompute the window every time you tune the cutoff frequency.

Lowpass to Highpass

Assuming a lowpass filter with normalized 6–dB cutoff frequency ωc, a highpass filter with the same cutoff frequency can be obtained by taking the complementary of the lowpass frequency response: HHP(e) = 1 — HLP(e)

Taking the inverse discrete Fourier transform of the above response, we get the following highpass filter coefficients:

for n=0hhp(n)=1hLP(n)for 1 |n|  Nhhp(n)=hLP(n)

Lowpass to Bandpass

A bandpass filtered centered at frequency ω0 can be obtained by shifting the lowpass response:

HBP(e) = HLP(ej(ω–ω0)) + HLP(ej(ω–ω0))

The bandwidth of the resulting bandpass filter is 2ωc, as measured between the two cutoff frequencies of the bandpass filter. The equivalent bandpass filter coefficients are then:

hBP(n)=(ejω0n+ejω0n)hLP(n)which can be written as:hBP(n)=2cos(ω0n)hLP(n)

Lowpass to Bandstop

We can transform a lowpass filter to a bandstop filter by combining the highpass and bandpass transformations. That is, first make the filter bandpass by shifting the lowpass response, and then invert in to get a bandstop response centered at ω0.

HBS(e) = 1 – (HLP(ej(ω–ω0)) + HLP(ej(ω+ω0)))

This yields the following coefficients:

for n=0hBS(n)=12cos(ω0n)hLP(n)for 1 |n|  NhBS(n)=2cos(ω0n)hLP(n)

Generalized Transformation

The transformations highlighted above can be combined to transform a lowpass filter to a lowpass, highpass, bandpass or bandstop filter with arbitrary cutoffs.

For example, to transform a lowpass filter with cutoff ωc1 to a highpass with cutoff ωc2, you first apply the lowpass-to-lowpass transformation to get a lowpass filter with cutoff ωc2, and then apply the lowpass-to-highpass transformation to get the highpass with cutoff ωc2.

To get a bandpass filter with center frequency ω0 and bandwidth β, we first apply the lowpass-to-lowpass transformation to go from a lowpass with cutoff ωc to a lowpass with cutoff β/2, and then apply the lowpass-to-bandpass transformation to get the desired bandpass filter. The same approach can be applied to a bandstop filter.


[1] Jarske, P.,Y. Neuvo, and S. K. Mitra, "A simple approach to the design of linear phase FIR digital filters with variable characteristics." Signal Processing. Vol. 14, Issue 4, June 1988, pp. 313-326.

Introduced in R2014a

Was this topic helpful?