Loading in 5 sec....

Lab 9 Improved FIR filterPowerPoint Presentation

Lab 9 Improved FIR filter

- 123 Views
- Uploaded on
- Presentation posted in: General

Lab 9 Improved FIR filter

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 - - - - - - - - - - - - - - - - - - - - - - - - - -

Lab 9 Improved FIR filter

Using SystemView

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.

Open it for reading:

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);

Turn in your Matlab code, and your hcoeffs.txt file

Now, repeat Lab 8. Use your hcoeffs.txt file in place of the coeffs.txt file you used in Lab 8. Notice the IMPROVED results.