# Homework Help: Low pass filter in Excel

1. Sep 25, 2007

### engineer23

1. The problem statement, all variables and given/known data

I have data for an ECG and I want to filter it.

2. Relevant equations

The problem tells me to run the signal through a low pass filter.
I tried a single pass double pole filter (essentially the average of three averages). If we have data points A, B, C, D, E, and F, then the filter takes the data and reduces it through the following formula: [(A+B+C)/3 + (B+C+D)/3 + (C+D+E)/3]/3

Also, the signal to noise ratio is the range of signal/range of noise.

3. The attempt at a solution

I implemented the filter in Excel. But when I plot the filtered data, I don't really see much noise reduction. Is there a better low-pass filter I can use that will give me a clear(er) ECG signal? If so, how do I implement it in Excel?

Thanks....

2. Sep 25, 2007

### Staff: Mentor

Is your filter FIR or IIR? I don't really understand your equation... the DSP equation for the next output will depend on a finite number of the previous inputs.... is that what you are trying to represent with your equation? The equation for an FIR LPF is not the simple average of the previous few inputs....

What impulse response are you designing for, and what design method are you using?

EDIT -- Here's some further reading at wikipedia.org: http://en.wikipedia.org/wiki/Digital_signal_processing

And I also really like the DSP book by Charles S. Williams. Check it out as a learning resource if you get a chance.

Last edited: Sep 25, 2007
3. Sep 25, 2007

### engineer23

I think it would help if I could show you the Excel file w/ my attempt at filtering. I can't attach it in a post though. Is there a way I can e-mail it to you or pm you with it? I think it would make the problem much clearer.

The filter should be FIR, since this is the only kind of filter we have talked about in class.

4. Sep 25, 2007

### Staff: Mentor

I don't think Excel attachments work on the PF. Can you just PDF a couple screenshots, with the active cell showing your running LPF equation? I have an Excel spreadsheet that I could do that with, but that would posting an answer, so I'm not able to do that....

5. Sep 25, 2007

### engineer23

OK....I have attached a screenshot of the spreadsheet. Column A is time and B is the original signal. My attempt at filtering is shown in the next two columnns. My formula for an "averaging" filter" can be seen in the Excel display.
I have also included the plot of the original ECG signal.

Is there an easier/better way to filter this data using a low pass filter that I am missing?

#### Attached Files:

File size:
55 KB
Views:
917
• ###### hw3plot.doc
File size:
54 KB
Views:
646
6. Sep 25, 2007

### wildman

Berkeman, et all,

The attachments are not oked yet, but looking at his formula, it is a FIR filter. You can tell because it has no feedback. It is an averaging filter (thats what a LPF is). Given how unsophisticed your approach is, I would guess that the filter rolls off too slowly or maybe your cutoff frequency is too high.

If you have Matlab available with the Signal Processing extensions, you can make a filter exactly to your specification very easily, but I suppose you don't since if you did you would not be trying to do it in excel.

I have to put a small child to bed so I need to go, but look on the web for an excellent FREE book on filters by Steven W Smith called Digital Signal Processing: A Practical Guide for Engineers and Scientists. It has some example code that might work you... Sorry, I have to go and then I have to study my own stuff...

7. Sep 26, 2007

### wildman

Child put to bed and homework done.

I going to guess because your attachments are still pending but try this:

Look in the free book I suggested at page 282. There is a cute little recursive filter there that may do the trick and would work well in Excel. It works well in fixed point and is simple to implement. The code (in Basic) is on page 284. Run it several times over the data. Tell me how it works out.

8. Sep 26, 2007

### Staff: Mentor

Here is a screenshot of the DSP practice sheet that I was mentioning....

#### Attached Files:

• ###### DSP Practice in Excel.jpg
File size:
72.4 KB
Views:
3,016
9. Sep 26, 2007

### engineer23

Thanks everyone! I used the recursive filter in Excel and my plot looks much less noisy. The Signal Processing book is a very useful resource!