FIRFilterWindow (FPScript)

21.09.2021

Calculates an FIR filter's impulse response using windowing.

Syntax

FIRFilterWindow(Window, Type, [ FilterLength ], Fc1, [ Fc2 ], [ Attenuation ], [ Transition ], [ Alpha = 0.54 ] [ , SamplingRate ])

 

The syntax of the FIRFilterWindow function consists of the following parts:

Part

Description

Window

Specifies the type of window.

The argument Window can have the following values:

Constant

Meaning

FILTER_RECTANGULAR

Rectangular window

FILTER_BARTLETT

Bartlett window

FILTER_HAMMING

Hamming window

FILTER_GENERALIZED_HAMMING

Generalized Hamming window

FILTER_HANNING

Hanning window

FILTER_BLACKMAN

Blackman window

FILTER_KAISER

Kaiser window

FILTER_DOLPHCHEBYSHEV

Dolph-Chebyshev windows

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Type

Specifies the filter type.

The argument Type can have the following values:

Constant

Meaning

FILTER_LOWPASS

Low pass, allows frequencies to pass that are below the cut-off frequency.

FILTER_HIGHPASS

High pass, allows frequencies to pass that are above the cut-off frequency.

FILTER_BANDPASS

Bandpass, allows frequencies to pass that are between the first and second cut-off frequency.

FILTER_BANDSTOP

Bandstop, allows frequencies to pass that are below the first and above the second cut-off frequency.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

FilterLength

Specifies the filter length. This argument is optional for Kaiser and Dolph-Chebyshev filters. The filter length can be calculated from the attenuation and transition.

Permitted data structures are scalar value. All integral data types are permitted.

The value must be greater or equal to 5 and less or equal to 999.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Fc1

Specifies the lower cut-off frequency of the filter. The cut-off frequency must be between 0 and 0.5, half of the normalized sampling frequency, or between 0 and half of the sampling rate.

Permitted data structures are scalar value. All real data types are permitted, except calendar time und time span.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Fc2

Specifies the upper cut-off frequency of the filter. The cut-off frequency must be between 0 and 0.5, half of the normalized sampling frequency, or between 0 and half of the sampling rate. This argument does not have to be specified for a low pass or high-pass filter.

Permitted data structures are scalar value. All real data types are permitted, except calendar time und time span.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Attenuation

Specifies the stop-band attenuation of the Dolph-Chebyshev or Kaiser filter. The attenuation can be calculated from the filter length and transition.

Permitted data structures are scalar value. All real data types are permitted, except calendar time und time span. The argument is transformed to the unit dB.

The value must be greater than 0 dB.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Transition

Specifies the distance (transition) between the stop-band and passband for the Dolph-Chebyshev or Kaiser filter. The transition can be calculated from the filter length and attenuation.

Permitted data structures are scalar value. All real data types are permitted, except calendar time und time span.

The value must be greater than 0.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

Alpha

Influences the attenuation behavior of the Generalized Hamming Window (Window Method). Alpha must be between 0 and 1.

Permitted data structures are scalar value. All real data types are permitted, except calendar time und time span.

The value must be greater or equal to 0 and less or equal to 1.

If the argument is a list, then the first element in the list is taken. If this is also a list, then the process is repeated.

If this argument is omitted, it will be set to the default value 0.54.

SamplingRate

Specifies the sampling rate. The argument is optional. If a sampling rate is specified, the absolute cut-off frequencies are specified for the cut-off frequencies instead of normalized frequencies.

Permitted data structures are scalar value. All real data types are permitted, except calendar time und time span.

The value must be greater than 0.

If the argument is a list, then the function is executed for each element of the list and the result is also a list.

Remarks

The argument FilterLength does not have to be specified for the Kaiser or Dolph-Chebyshev filter. It can be calculated from the attenuation and transition. For the two filters, two of the three arguments FilterLength, Attenuation and Transition must be specified. However, only attenuations greater than 21 dB can be calculated from the filter length and transition. If all three arguments are specified, then the transition is recalculated and corrected if necessary.

The attenuation is specified in decibels (20 log delta).

Available in

Option Digital Filters

Examples

Filter(Signal, FIRFilterWindow(FILTER_DOLPHCHEBYSHEV, FILTER_LOWPASS, , 250 Hz, , 30 dB, 10 Hz, , SamplingRate(Signal)), , TRUE)

Filters a signal with phase correction using a low pass filter with a Hamming window. The filter length is determined from the attenuation and the transition. Note also that the third argument of the Filter function is left empty.

See Also

Filter Function

FIRFilterEquiripple Function

IIRFilter Function

Digital Filters Option

FIR Filter Analysis Object (Window Method)

Window Method

Filter Tutorial

Share article or send as email:

You might be interested in these articles