DESIGN OF A FIR DIGITAL FILTER
A digital filter is a system that performs mathematical operations on a sampled, digitized signal to reduce or enhance certain features of the processed signal. For the design of filters, complex calculations are required. Mathematically, by substituting the values of parameters according to any of the filters used in any of the methods from the window method, frequency sampling method, or optimal method we can get the values of filter coefficients h(n). Mainly there are two types of digital filters, known as FIR (Finite Impulse Response) Filters and IIR (Infinite Impulse Response) Filter. In this design project, design an FIR Filter. FIR Filters have an exactly linear phase response. But the IIR filterβs phase response is nonlinear. Also, Unlike IIR Filters, FIR filters are always stable, and the coefficient quantization errors are also much less than IIR filters.
The Equation of IIR Filter, π(π)= β β(π)π₯(πβπ) ; for k=0 to β
The Equation of FIR Filter, π(π)= β β(π)π₯(πβπ) ; for k =0 to n-1
There are many methods to design an FIR filter that are Fourier series method, Frequency Sampling Method, and Window method. There are many windows are exist to approximate desired characteristics such as rectangular windows, Triangular windows, Bartlett windows, Raised Cosine windows and kaiser windows. Among these methods, Ripple parameter can include to calculation with only kaiser window method. In this design project, uses kaiser window method to implement the design.
The Basic Structure of FIR Filter,
%Filter specifications
Ap = 0.26; %Maximum pass band ripple 0.26dB
Aa = 41+0.038; %Minimum stop band attenuation 41dB
P1 = 1200; %Lower pass band edge 1200 rad/s
P2 = 1700; %Upper pass band edge 1700 rad/s
A1 = 900; %Lower stop band edge 900 rad/s
A2 = 1900; %Upper stop band edge 1900 rad/s
S = 4600; %Sampling frequency 4600 rad/s
Ap_1 = (1-10^(-Ap/20)) % Ripple Precentage
Aa_1 = 10^(-Aa/20); % Attenuation precentage
%filter order, normalized frequency band edges, Beta factor,Type
[n,Wn,beta,ftype] = kaiserord([A1 P1 P2 A2],[0 1 0],[Aa_1 Ap_1 Aa_1],S);
%Compute Kaiser Window
figure(1);
window = kaiser(n+1,beta);
wvtool(window);
%coefficients of FIR filters
figure(2);
b = fir1(n,Wn,ftype,window,'noscale');
freqz(b,1,1024,S);
figure(3);
freqz(b,1,1024,S);
xlim([1200 1700]);
%Impulse response
figure(4);
impz(b,1);
% Plot all figures