# fir_lsq (MathScript RT Module Function)

LabVIEW 2012 MathScript RT Module Help

Edition Date: June 2012

Part Number: 373123C-01

»View Product Info Download Help (Windows Only)

Owning Class: filter design

Requires: MathScript RT Module

## Syntax

y = fir_lsq(n, f, a)

y = fir_lsq(n, f, a, w)

y = fir_lsq(n, f, a, option)

y = fir_lsq(n, f, a, w, option)

Legacy Name: `firls`

## Description

Designs a least-squares linear FIR filter.

Details

Examples

## Inputs

Name Description
n Specifies the filter order. n is a nonnegative integer.
f Specifies the normalized frequencies at which you want to take samples. The size of f must be even. f is a vector.
a Specifies the amplitudes at each of the f frequencies. a is a vector of the same size as f.
w Specifies the weight. w is a vector that is half the length of f.
option Specifies the odd-symmetry filter to design. option is a string that accepts the following values.

 'differentiator' Designs a differentiator filter. 'Hilbert' Designs a Hilbert filter.

## Outputs

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

## Details

If f = [0.1, 0.2, 0.3, 0.4] and a = [1, 1, 0, 0], LabVIEW ignores the interval [0.2, 0.3] and attempts to implement a filter whose amplitude is 1 in [0.1, 0.2] and 0 in [0.3, 0.4].

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 = 11;
F = [0.1, 0.2, 0.3, 0.4];
A = [1, 1, 0, 0];
Y = fir_lsq(N, F, A)

Not Helpful