<< Chapter < Page Chapter >> Page >

Filters are also classified by the length of their impulse response. If the output of a filter depends only ona specified number of samples, the filter is said to have a finite impulse response, abbreviated FIR. Otheriwse,it is said to have an infinite impulse response, abbreviated IIR.The bulk of the filters in Software Receiver Design are FIR filters with a flat passband, because these are the most commonfilters in a typical receiver. But other filter profiles are possible, and the techniques offilter design are not restricted to flat passbands. "Implementing FIR Filters" shows several ways that digital FIR filters can be implemented in M atlab . IIR filters arise whenever there is a loop(such as in a phase locked loop), and one special case (the integrator) is an intrinsic piece of theadaptive elements. "Implementing IIR Filters" shows how to implement IIR filters. "Filter Design" shows how to design filters with specific properties,and how they behave on a number of test signals.

Implementing fir filters

Suppose that the impulse response of a discrete-time filter is h [ i ] , i = 0 , 1 , 2 , ... , N - 1 . If the input to the filter is the sequence x [ i ] , i = 0 , 1 , ... , M - 1 , then the output is given by the convolution [link] . There are four ways to implement this filtering in M atlab :

  • conv directly implements the convolution equation and outputs a vector of length N + M - 1 .
  • filter implements the convolution so as to supply one output value for each input value; the output is of length M .
  • In the frequency domain, take the FFT of the input, the FFT of the output, multiply the two, and take the IFFTto return to the time domain.
  • In the time domain, pass through the input data, at each time multiplying by the impulse response and summing the result.

Probably the easiest way to see the differences is to play with the four methods.

h=[1 -1 2 -2 3 -3];                      % impulse response h[k]x=[1 2 3 4 5 6 -5 -4 -3 -2 -1];          % input data x[k]yconv=conv(h,x)                          % convolve x[k]*h[k]yfilt=filter(h,1,x)                      % filter x[k] with h[k]n=length(h)+length(x)-1;                 % pad length for FFT ffth=fft([h zeros(1,n-length(h))]);      % FFT of impulse response = H[n] fftx=fft([x, zeros(1,n-length(x))]);     % FFT of input = X[n] ffty=ffth.*fftx;                         % product of H[n] and X[n] yfreq=real(ifft(ffty))                   % IFFT of product gives y[k]z=[zeros(1,length(h)-1),x];              % initial state in filter = 0for k=1:length(x)                        % time domain method   ytim(k)=fliplr(h)*z(k:k+length(h)-1)';  % iterates once for each x[k]end                                      % to directly calculate y[k]
waystofilt.m “conv” vs. “filter” vs. “freq domain” vs. “time domain” (download file)

Observe that the first M terms of yconv , yfilt , yfreq , and ytim are the same, but that both yconv and yfreq have N-1 extra values at the end. For both the time domain method and the filter command, the output values are aligned in time with the input values,one output for each input. Effectively, the filter command is a single line implementation of the time domain for loop.

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