Signal Processing Toolbox Help Desk

firls

Purpose

Least square linear-phase FIR filter design.

Syntax

Description

firls designs a linear-phase FIR filter that minimizes the weighted, integrated squared error between an ideal piecewise linear function and the magnitude response of the filter over a set of desired frequency bands.

b = firls(n,f,a) returns row vector b containing the n+1 coefficients of the order n FIR filter whose frequency-amplitude characteristics approximately match those given by vectors f and a. The output filter coefficients, or "taps," in b obey the symmetry relation

These are type I (n odd) and type II (n even) linear-phase filters. Vectors f and a specify the frequency-amplitude characteristics of the filter:

The relationship between the f and a vectors in defining a desired amplitude response is

b = firls(n,f,a,w) uses the weights in vector w to weight the fit in each frequency band. The length of w is half the length of f and a, so there is exactly one weight per band.

b = firls(n,f,a,'ftype') and

b = firls(n,f,a,w,'ftype') specify a filter type, where ftype is

Examples

Design an order 255 lowpass filter with transition band:

Design a 31 coefficient differentiator:

Design a 24th-order anti-symmetric filter with piecewise linear passbands and plot the desired and actual frequency response:

Algorithm

Reference [1] describes the theoretical approach that firls takes. The function solves a system of linear equations involving an inner product matrix of size roughly n/2 using MATLAB's \ operator.

This function designs type I, II, III, and IV linear-phase filters. Type I and II are the defaults for n even and odd respectively, while the 'hilbert' and 'differentiator' flags produce type III (n even) and IV (n odd) filters. The various filter types have different symmetries and constraints on their frequency responses (see [2] for details).

Linear Phase Filter type


Filter Order n



Symmetry of Coefficients


Response H(f), f = 0


Response H(f), f = 1 (Nyquist)

Type I

Even

even:

No restriction

No restriction

Type II

Odd

No restriction

H(1) = 0

Type III

Even

odd:

H(0) = 0

H(1) = 0

Type IV

Odd

H(0) = 0

No restriction

Diagnostics

An appropriate diagnostic message is displayed when incorrect arguments are used:

A more serious warning message is

This tends to happen when the filter length times the transition width grows large. In this case, the filter coefficients b might not represent the desired filter. You can check the filter by looking at its frequency response.

See Also

fir1

Window-based finite impulse response filter design-- standard response.

fir2

Window-based finite impulse response filter design-- arbitrary response.

firrcos

Raised cosine FIR filter design.

remez

Parks-McClellan optimal FIR filter design.

References

[1] Parks, T.W., and C.S. Burrus. Digital Filter Design. New York: John Wiley & Sons, 1987. Pgs. 54-83.

[2] Oppenheim, A.V., and R.W. Schafer. Discrete-Time Signal Processing. Englewood Cliffs, NJ: Prentice Hall, 1989. Pgs. 256-266.



[ Previous | Help Desk | Next ]