You are on page 1of 1

FIR FILTER DESIGN USING MATLAB Design of FIR filters are based on directly approximating the desired frequency

response of the discrete time system. Most techniques used to design FIR filters use linear phase constraint. The simplest method of FIR filter design is called window method. To obtain a casual FIR filter a window truncates frequency response of the ideal filter. According to the type of window that is selected different approximation of the filter will be obtained. For further information read the DSP textbook. In order to design a FIR filter using Matlab we can use fir1 and Filter commands. The format of fir1 is as follows: LOW PASS: - B = FIR1(N,Wn) designs an N' th order low pass FIR digital filter and returns the filter coefficients in length N+1 vector B. For example in order to design a FIR filter assuming a sampling rate of 48khz and having a low pass filter with the cut off frequency of 10khz by windowing method: B=fir1(40,10.0/(48.0/2))=fir1( N, fc/(fs/2) ) HIGH PASS: - B = FIR1(N,Wn,'high')=FIR1(N,fc/(fs/2),high) designs an N'th order high pass filter. BAND PASS: If Wn is a two-element vector, Wn = [W1 W2], FIR1 returns an order N band pass filter with pass band W1 < W < W2. Example: FIR1( N , [f1/(fs/2) f2/(fs/2)] ) BAND STOP: If Wn = [W1 W2], B = FIR1(N,Wn,'stop') will design a band stop filter. FIR1( N , [ f1/(fs/2) f2/(fs/2) ], stop ) FILTER command (One-dimensional digital filter) : Y = FILTER(B,A,X) filters the data in vector X with the filter described by vectors A and B to create the filtered data Y. For FIR filters A=1 because they do not contain any poles. FREQZ(b,1,f,fs) will plot frequency response of the filter designed above for the designated f vector.

You might also like