Lab 9 Improved FIR filter

1 / 6

# Lab 9 Improved FIR filter - PowerPoint PPT Presentation

Lab 9 Improved FIR filter. Using SystemView. Improved FIR filter. Lab objective Use SystemView to simulate/analyze an improved window based filter. This is similar to the filter we analyzed in Lab 8, but is improved by using a Hamming window.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Lab 9 Improved FIR filter

Using SystemView

Improved FIR filter

Lab objective

Use SystemView to simulate/analyze an improved window based filter. This is similar to the filter we analyzed in Lab 8, but is improved by using a Hamming window.

I hope we’ll be able to do a realtime implementation of this filter using the Analog Devices EZ-Kits next week. If not, we’ll implement it using Matlab.

Improved FIR filter

First, we’ll use Matlab to generate a Hamming window, and apply it to the truncated and shifted impulse response we used in Lab 8.

The formula for the Hamming window is given in Cartinhour, eq. 9-7. Use this formula, in Matlab, to generate a Hamming window with N = 29.

Import the filter coefficients we used in lab 8, which are in the file coeffs.txt. Use the Matlab fopen, fscanf, and fclose functions.

Improved FIR filter

Save the coeffs.txt file in your Matlab “Work” directory, or in a directory in the search path if using Octave.

fid = fopen(‘coeffs.txt’, ‘r’);

create a vector to hold the raw impulse response, then read in the coefficients using fscanf:

hi = zeros(1, 29);

hi = fscanf(fid, ‘%9f’);

Close the file.

fclose(fid);

Improved FIR filter

Transpose the vector you just read:

hi = hi’;

Plot the raw impulse response

Plot the Hamming window you generated

Now, multiply the Hamming window point-by-point with the raw impulse response. If your Hamming window vector is called w,

h = w .* hi;

Plot the result, note the differences.

Now, write the windowed impulse response to a new file.

Improved FIR filter

Create a new file ‘hcoeffs.txt’, and open it for writing:

fid = fopen(‘hcoeffs.txt’, ‘w’);

fprintf(fid, ‘%9.6f\r\n’, h);

fclose(fid);