# fir_win (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info

Owning Class: filter design

Requires: MathScript RT Module

## Syntax

b = fir_win(n, w)

b = fir_win(n, w, option)

b = fir_win(n, w, window)

b = fir_win(n, w, s)

b = fir_win(n, w, option, window)

b = fir_win(n, w, option, s)

b = fir_win(n, w, option, window, s)

Legacy Name: `fir1`

## Description

Uses the window design method to design a linear phase FIR filter. This function windows the impulse response with a Hamming window by default.

Examples

## Inputs

Name Description
n Specifies the filter order. n is a nonnegative integer. n must be even for filters with a non-zero gain at the Nyquist frequency. If n does not meet this condition, LabVIEW increases n by 1.
w Specifies the cutoff frequencies of the filter. w is real scalar or ascending vector with elements between 0 and 1. 1 represents the Nyquist frequency. fir_win generally designs a multiband FIR filter with bands 0<w<w1w1<w<w2wn<w<1.
option Specifies the type of filter to design. option is a string that accepts the following values.

 'low' (default) Designs a lowpass filter. 'high' Designs a highpass filter. 'bandpass' Designs a bandpass filter. 'stop' Designs a stopband filter. 'DC-0' Designs a multiband filter whose first band is a stopband. 'DC-1' Designs a multiband filter whose first band is a passband.
window Specifies the window coefficients. The length of window must equal n + 1. If n is even and the filter has a non-zero gain at the Nyquist frequency, the length of window must equal n + 2.
s Specifies whether the magnitude of the designed filter is normalized. s is a string that accepts the following values.

 'scale' (default) Directs LabVIEW to scale the filter coefficients. 'noscale' Directs LabVIEW not to scale the filter coefficients.

## Outputs

Name Description
b Returns the filter coefficients of order n. b is a real vector.

## Details

The following table lists the support characteristics of this function.

 Supported in the LabVIEW Run-Time Engine Yes Supported on RT targets Yes Suitable for bounded execution times on RT Not characterized

## Examples

N = 5;
W = 0.2;
B = fir_win(N, W, 'low', win_hann2(6))