FIR filter Window method

Syntax
Hd = firwin(Order,Frequencies,Window,Type,DFormat)

Description
FIR filter design based on the Window method.

Order: may be specified up to 499 (professional) and up to 128 (educational) edition.

Frequencies: lowpass and highpass are specified via one cut-off frequency, whereas bandpass, bandstop and hilbert filters require two frequencies (i.e. lower and upper cut-off). All frequencies must be ascending in order and < Nyquist (see the example below). Window: The firwin method supports the following window functions: rectangular, blackman, blackmanharris, hamming, hanning, flattop and Chebyshev

Type: The firwin method facilitates the design of lowpass, highpass, bandpass, bandstop and hilbert filters respectively.

Hd: the firwin method designs an FIR window filter based on the entered specifications and places the transfer function (i.e. numerator and gain) into a digital filter object, Hd. The digital filter object can then be combined with other methods if so required. For a digital filter object, Hd, calling getnum(Hd) and getgain(Hd) will extract the numerator and gain coefficients respectively – see below.

DFormat: allows you to specify the display format of resulting digital filter object.

symbolic Display a symbolic representation of the filter object. If the order > 10, the symbolic display option will be overridden and set to numeric
numeric Display a matrix representation of the filter object
void Create a filter object, but do not display output

Examples

ClearH1;  // clear primary filter from cascade
ShowH2DM;

interface L = {10,400,10,50};

Main()

F={40,90};
Hd=firwin(L,F,"hamming","bandstop","numeric"); // Bandpass with a Hamming window
Hd=firwin(L,F,"hanning","hilbert","numeric");  // Hilbert with a Hanning Window

Num=getnum(Hd);
Den={1};
Gain=getgain(Hd);

See also:

movaver / firwin / firminphase / firarb / firkaiserfirgaussfirlp2notchsavgolay