Engee documentation

EngeeDSP.VariableBandwidthFIRFilter

FIR filter with variable bandwidth.

Library

EngeeDSP

Description

To implement a variable bandwidth FIR filter that filters each channel of the input signal, follow these steps:

  1. Create an object EngeeDSP.VariableBandwidthFIRFilter and set its properties.

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

To learn more about how to work with system objects, see Engee System Objects.

Syntax

Creation

  • vbwFIR = EngeeDSP.VariableBandwidthFIRFilter() returns the FIR filter object vbwFIR with variable bandwidth, which independently filters each channel (column) of the input signal during successive calls to the algorithm. The filter cutoff frequency can be adjusted during the filtering operation. A variable-bandwidth FIR filter is designed using the windowing method.

  • vbwFIR = EngeeDSP.VariableBandwidthFIRFilter(Name=Value) returns the FIR filter object vbwFIR with the specified property Name, set to the specified value Value. You can specify additional arguments as a name-value pair in any order (Name1=Value1,…​,NameN=ValueN). Unspecified properties have default values.

Using

  • y = vbwFIR(x) filters the input signal x and outputs the filtered values y. The variable bandwidth FIR filter object works with each channel, which means that the object filters each column of the input signal independently with successive calls to the algorithm.

Arguments

Input arguments

x — input signal

+ vector | the matrix

Details

The input signal is specified as a vector or matrix. This system object supports variable-size input data. After locking the object, you can change the size of each input channel, but you cannot change the number of channels.

Типы данных

Float32, Float64

Support for complex numbers

Yes

Output arguments

y — filtered output signal

+ vector | the matrix

Details

The filtered output signal returned as a vector or matrix. The size, data type, and complexity of the output signal are the same as the input signal.

Типы данных

Float32, Float64

Support for complex numbers

Yes

Features

# FilterOrder — FIR filter order

+ 30 (by default) | an even positive scalar

Details

The FIR filter order, given as an even positive scalar.

Типы данных

Float32, Float64

# filterType — type of filter characteristic

+ "Lowpass" (by default) | "Highpass" | "Bandpass" | "Bandstop"

Details

The type of filter characteristic, set as "Lowpass", "Highpass", "Bandpass" or "Bandstop".

# Cutoffrequency — filter cutoff frequency

+ 512 (by default) | positive scalar

Details

The cutoff frequency of the filter in Hz or in normalized frequency units, set as a positive scalar.

If the property NormalizedFrequency is set to:

  • false — the cutoff frequency value is indicated in Hz. The value must be less than half of the value of the SampleRate.

  • true — the cutoff frequency value is specified in normalized frequency units. The value must be a positive scalar less than 1.0.

Dependencies

To use this property, set the [Property:filterType] value Lowpass or Highpass.

Типы данных

Float32, Float64

# Window — window function

+ "Hann" (by default) | "Hamming" | "Chebyshev" | "Kaiser"

Details

A window function for designing an FIR filter, defined as "Hann", "Hamming", "Chebyshev" or "Kaiser".

# KaiserWindowParameter — parameter of the Kaiser window

+ 0.5 (by default) | the real scalar

Details

The parameter of the Kaiser window, set as a real scalar.

Dependencies

To use this property, set the Window value Kaiser.

Типы данных

Float32, Float64

# CenterFrequency — the center frequency of the filter

+ 11025 (by default) | positive scalar

Details

The center frequency of the filter in Hz or in normalized frequency units, set as a positive scalar.

If the property NormalizedFrequency is set to:

  • false — the value of the central frequency is indicated in Hz. The value must be less than half of the value of the SampleRate.

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

Dependencies

To use this property, set the [Property:filterType] value Bandpass or Bandstop.

Типы данных

Float32, Float64

# Bandwidth — filter bandwidth

+ 7680 (by default) | positive scalar

Details

The filter bandwidth in Hz or in normalized frequency units, set as a positive scalar.

If the property NormalizedFrequency is set to:

  • false — the bandwidth value is specified in Hz. The value must be less than half of the value of the SampleRate.

  • true — The bandwidth value is specified in normalized frequency units. The value must be a positive scalar less than 1.0.

Dependencies

To use this property, set the [Property:filterType] value Bandpass or Bandstop.

Типы данных

Float32, Float64

# SidelobeAttenuation — attenuation of the side lobes of the Chebyshev window

+ 60 (by default) | positive scalar

Details

Attenuation of the side lobes of the Chebyshev window in dB, set as a positive scalar.

Dependencies

To use this property, set the Window value Chebyshev.

Типы данных

Float32, Float64

# NormalizedFrequency — specifying frequencies in normalized units

+ false (default) | true

Details

If you set this property to:

  • true — the filter bandwidth frequency, center frequency, and filter bandwidth should be set in normalized frequency units and their value should be less than 1.0.

  • false — The filter bandwidth frequency, center frequency, and filter bandwidth must be set in Hz. You can specify the sampling rate of the input signal using the SampleRate.

Типы данных

Bool

# * SampleRate* is the sampling rate of the input signal

+ 44100 (by default) | positive scalar

Details

The sampling frequency of the input signal in Hz, set as a positive scalar.

Dependencies

To use this property, set the NormalizedFrequency property to false.

Типы данных

Float32, Float64

Methods

Common to all system objects

step!

Run the system object operation algorithm

release!

Allow changing the value of a system object property

reset!

Resetting the internal states of a system object

Algorithms

FIR transformations

Details

All transformations assume the presence of a low-pass filter with a length of .

_ From low-pass filter to low-pass filter_

Consider an ideal low-pass filter of the "brick wall" type with a normalized cutoff frequency . By performing the inverse discrete Fourier transform of the ideal frequency response and limiting the resulting sequence to length , we obtain the impulse response

  • for :

  • for :

where — window vector. Let’s set the low-pass filter coefficients to the new cutoff frequency as follows:

  • for :

  • for :

There is no need to recalculate the window size every time you adjust the cutoff frequency.

_ From low-pass filter to high-pass filter_

Assume that the low-pass filter has a normalized cutoff frequency , equal to 6 dB. A high-pass filter with the same cutoff frequency can be obtained by supplementing the frequency response of the low-pass filter.:

Taking the inverse discrete Fourier transform from the above characteristic, we obtain the following high-pass filter coefficients:

  • for :

  • for :

_ From low-pass filter to bandpass filter_

We get a bandpass filter with a central frequency by shifting the frequency response of the low-pass filter:

The bandwidth of the resulting bandpass filter is measured between the two cutoff frequencies of the bandpass filter. The equivalent bandpass filter coefficients will then be as follows:

which can be rewritten as

_ From low-pass filter to barrier filter_

You can convert a low-pass filter into a barrier filter by combining transformations of high-pass filters and bandpass filters. First, we create a band-pass filter by shifting the frequency response of the low-pass filter, and then invert it to get a center-frequency blocking filter. .

The result is the following coefficients:

  • for :

  • for :

The generalized transformation

You can combine these transformations to convert a low-pass filter into a low-pass filter, a high-pass filter, a bandpass filter, or a barrier filter with arbitrary cutoff frequencies.

For example, to convert a low-pass filter to a cutoff frequency in a high-pass filter with a cutoff frequency first, a conversion from a low-pass filter to a low-pass filter is applied to obtain a low-pass filter with a cutoff frequency and then a conversion from a low-pass filter to a high-pass filter is applied to get a high-pass filter with a cutoff frequency .

To get a bandpass filter with a center frequency and bandwidth first, a conversion from a low-pass filter to a low-pass filter is applied to go from a low-pass filter with a cutoff frequency to a low-pass filter with a cutoff frequency and then a conversion from a low-pass filter to a bandpass filter is applied to get the desired bandpass filter. A similar approach can be used for a barrier filter.

Literature

  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.