<< Chapter < Page Chapter >> Page >

The general form of an IIR filter is

y [ k + 1 ] = a 0 y [ k ] + a 1 y [ k - 1 ] + . . . + a n y [ k - n ] + b 0 x [ k ] + b 1 x [ k - 1 ] + . . . + b m x [ k - m ] ,

which can be rewritten more concisely as

y [ k + 1 ] = a T y [ k ] + b T x [ k ]

where

a = [ a 0 , a 1 , . . . , a n ] T b = [ b 0 , b 1 , . . . , b m ] T

are column vectors of the parameters of the filter and where

x [ k ] = [ x [ k ] , x [ k - 1 ] , . . . , x [ k - m ] ] T y [ k ] = [ y [ k ] , y [ k - 1 ] , . . . , y [ k - n ] ] T

are vectors of past input and output data. The symbol z T indicates the transpose of the vector z . In M atlab , transpose is represented using the single apostrophe ' , but take care: when using complex numbers, the apostrophe actually implements a complex conjugateas well as transpose.

M atlab has a number of functions that make it easy to explore IIR filtering.For example, the function impz plots the impulse response of a discrete IIR (or FIR) filter.The impulse response of the system [link] is found by entering b=1; a=[1, -0.8]; impz(b,a) The parameters are the vectors b= [ b 0 , b 1 , . . . , b m ] and a= [ 1 , - a 0 , - a 1 , . . . , - a n ] . Hence the above code gives the responsewhen a of [link] is + 0 . 8 . Similarly, the command freqz(b,a) displays the frequency response for the IIR filter where b and a are constructed in the same way.

The routine waystofiltIIR.m explores ways of implementing IIR filters. The simplest method uses the filter command. For instance filter(b,a,d) filters the data d through the IIR system with parameters b and a defined as above. This gives the same output as first calculating the impulse response h and then using filter(h,1,d) . The fastest (and most general) way to implement the filter is in the for loop at the end, which mimics the time domain method for FIR filters, but includes the additionalparameters a .

a=[1 -0.8]; lena=length(a)-1;       % autoregressive coefficientsb=[1]; lenb=length(b);              % moving average coefficientsd=randn(1,20);                      % data to filter if lena>=lenb,                      % dimpulse requires lena>=lenb   h=impz(b,a);                      % impulse response of filter  yfilt=filter(h,1,d)               % filter x[k] with h[k]end yfilt2=filter(b,a,d)                % filter directly using a and by=zeros(lena,1); x=zeros(lenb,1);   % initial states in filter for k=1:length(d)-lenb              % time domain method  x=[d(k);x(1:lenb-1)];             % past values of inputs  ytim(k)=-a(2:lena+1)*y+b*x;       % directly calculate y[k]   y=[ytim(k);y(1:lena-1)];          % past values of outputs end
waystofiltIIR.m ways to implement IIR filters (download file)

Like FIR filters, IIR filters can be lowpass, bandpass, highpass, or can have almost any imaginableeffect on the spectrum of its input.

Some IIR filters can be used as inverses to some FIR filters. Show that the FIR filter

x [ k ] = 1 b r [ k ] - a b r [ k - 1 ] .

is an inverse of the IIR filter [link] .

FIR filters can be used to approximate the behavior of IIR filters by truncating the impulse response.Create a FIR filter with impulse response given by the first 10 terms of [link] for a = 0 . 9 and b = 2 . Simulate the FIR filter and the IIRfilter [link] in M atlab , using the same random input to both. Verify that the outputsare (approximately) the same.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Software receiver design. OpenStax CNX. Aug 13, 2013 Download for free at http://cnx.org/content/col11510/1.3
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Software receiver design' conversation and receive update notifications?

Ask