Sunteți pe pagina 1din 2

Lab 8: IIR Filtering

Nasir Ahmed

Introduction:

In this lab, we learn the concept of the IIR filter. In the first part of the lab we are to use
MATLAB to design a fourth order IIR filter through the cascading of two second order
IIR filters. We learn how to derive difference equations and from these equations, how
the transfer function is derived. We next learn how to implement this on a fixed point
processor (TI C6211).

Exercise 8.1)

From the block diagram of figure 1, we verify that the transfer function is indeed correct.
‘w[n]=x[n]G-a1*w[n-1]-a2*w[n-2]’
‘y[n]=w[n]+b1*w[n-1]+b2*w[n-2]’
if we simply replace w(n-k) with w*z^(-k), and solve for w, we get:
w=xG/(1+a1z^-1+a2z2^-2)
and y=w(1+b1z^-1+b2z^-2), hence
Y(z)/X(z)= G(1+b1z^-1+b2z^-2)/(1+a1z^-1+a2z2^-2)

Next, we designed a fourth order elliptical IIR lowpass filter, with a cutoff frequency of
1kHz. The MATLAB command is as follows:

[B,A]=ellip(4,0.25,10,0.25);
freqz(B,A);

Next, by find the roots of B, A, we discovered that the roots were in pairs of complex
conjugates. So, we found the polynomial of the complex conjugates, used one set of
numerator and denominator as one system, and the other set as the second portion of the
cascaded system. The result is 2 second order systems in cascade to represent a first
order system. However, next we must determine the gain factor G1*G2=G to make sure
that all intermediate signal do not over flow and are in the range (-1,1). This was
accomplished with the following MATLAB script:

[B,A]=ellip(4,0.25,10,0.25);
%freqz(B,A);
zer=roots(B);
pol=roots(A);

num1=poly(zer(1:2));
num2=poly(zer(3:4));
den1=poly(pol(1:2));
den2=poly(pol(3:4));

x=zeros(1,500);
x(1)=1;
temp1=filter(num1,den1,x);
G1=1/sum(temp1);

temp2=filter(num2,den2,x);
G2=1/sum(temp2);
G=G1*G2;

G1=0.0373
G2=0.4049

So, now we have found the gain factors G1,G2 of the first and second system
respectively.

8.2 (IIR filter implementation):

Next, we need to implement this IIR filter in the code composer studio in C. This was
simply a modification of the FIR filter. In fact, the code is much simpler than the FIR
filter. This is because all we need to do in the code is store some previous elements (the
memory), and the coefficients, and perform the difference equation calculations. This is
straight forward as can be seen in the attached code.

Conclusion/Recommendations:

This lab was very useful in teaching us the basics of IIR filtering. We learned some
implementation issues of the IIR filter in the DSP. We also learned some more filter
design in MATLAB. In terms of length, this lab was a perfect length, it took us about 4
hours. However, I wish there was some more background on IIR filtering in the lab
manual. I didn’t really understand the need for G1, G2 from the handout itself. It took
more contemplation. Additionally, section 8.1 took us longer than 8.2! This was because
I felt the instructions in 8.1 weren’t sufficient.

S-ar putea să vă placă și