Hi,
I need some simple to understand filters/Filter, Basically i am looking at
an ECG waveform and i need to clean it up. as it seems to have high
frequency noise all over the trace.
I have tried the following filter which does clean the waveform up:-
float UpdateFilter(float meas, float k)
{
static float filterOutput = 0.0;
filterOutput += k * (meas - filterOutput);
return(filterOutput);
}
using the following site: -
http://en.wikipedia.org/wiki/Low-pass_filter
The problem is that it is either not cleaning the wave form enough or
removing parts of the waveform i need.
I will try and capture some unfiltered and filtered waveforms later.
but i think i need either a band-pass of LP with multiple poles, but have
not found any written in C than i can convert to Visual Basic.
The Hardware starts with a 3.3Hz HP filter than is sent through an
instrument amplifier with a gain of 1000 the output then goes through a
50Hz notch filter, after which is sent through another op-amp with variable
gain (1 to 100) and DC offset. after which it is sent through a 1Khz LP
filter then into my 10Bit ADC which is sampled at 300 times a second.
The following diagram shows the wave form i need to fiter from the noise:
-
http://en.wikipedia.org/wiki/File:SinusRhythmLabels.svg
The above filter I am using seems to work well apart from it removes peaks
P and T from the diagram above, or simply leaves the noise on them.
I did DSP 5 years ago at university so have forgotten most of what I
needed a little help, as to which filter and some sample code or website
reference, i have ordered a DSP for idiots book from amazon, so that may
well help
Thanks,
Andy
FIR or IIR? Filter help
Started by ●September 2, 2009
Reply by ●September 2, 20092009-09-02
On Sep 2, 11:19�am, "Xplosiv_166" <andrew_...@msn.com> wrote:> Hi, > > I need some simple to understand filters/Filter, Basically i am looking at > an ECG waveform and i need to clean it up. as it seems to have high > frequency noise all over the trace. > > I have tried the following filter which does clean the waveform up:- > > float UpdateFilter(float meas, float k) > { > �static float filterOutput = 0.0; > �filterOutput += k * (meas - filterOutput); > �return(filterOutput); > > } > > using the following site: - > > http://en.wikipedia.org/wiki/Low-pass_filter > > The problem is that it is either not cleaning the wave form enough or > removing parts of the waveform i �need. > > I will try and capture some unfiltered and filtered waveforms later. > > but i think i need either a band-pass of LP with multiple poles, but have > not found any written in C than i can convert to Visual Basic. > > The Hardware starts with a 3.3Hz HP filter than is sent through an > instrument amplifier with a gain of 1000 �the output then goes through a > 50Hz notch filter, after which is sent through another op-amp with variable > gain (1 to 100) and DC offset. after which it is sent through a 1Khz LP > filter then into my 10Bit ADC which is sampled at 300 times a second. > > The following diagram shows the wave form i need to fiter from the noise: > - > > http://en.wikipedia.org/wiki/File:SinusRhythmLabels.svg > > The above filter I am using seems to work well apart from it removes peaks > P and T from the diagram above, or simply leaves the noise on them. > > I did DSP 5 years ago at university so have forgotten most of what I > needed a little help, as to which filter and some sample code or website > reference, i have ordered a DSP for idiots book from amazon, so that may > well help > > Thanks, > > AndyShort the input to the hardware and preform an FFT of the noise, then an FFT of the ideal signal, if frequency content overlaps no filtering will help, you have to fix the hardware. If frequency content doesn't overlap the filtering you need should be apparent.
Reply by ●September 2, 20092009-09-02
joepierson wrote: ...> > Short the input to the hardware and preform an FFT of the noise, then > an FFT of the ideal signal, if frequency content overlaps no filtering > will help, you have to fix the hardware. If frequency content doesn't > overlap the filtering you need should be apparent.If the noise is relatively low-level and generally static in character, and you can isolate the noise in this way, spectral subtraction can work quite well - FFT the noise, FFT the audio in frames, and subtract the noise FFT from the source FFT frames. It is the basis for a lot of single-ended audio noise reduction techniques. Audacity has a spectral noise reduction tool that can be tried for a quick-n-dirty test of the principle. Richard Dobson
Reply by ●September 2, 20092009-09-02
>joepierson wrote: >... >> >> Short the input to the hardware and preform an FFT of the noise, then >> an FFT of the ideal signal, if frequency content overlaps no filtering >> will help, you have to fix the hardware. If frequency content doesn't >> overlap the filtering you need should be apparent. > >If the noise is relatively low-level and generally static in character, >and you can isolate the noise in this way, spectral subtraction can work>quite well - FFT the noise, FFT the audio in frames, and subtract the >noise FFT from the source FFT frames. It is the basis for a lot of >single-ended audio noise reduction techniques. > >Audacity has a spectral noise reduction tool that can be tried for a >quick-n-dirty test of the principle. > >Richard Dobson >Hi all, thanks for your help By short the inputs you mean connect the non-inverting and inverting inputs to the differential amplifier together to make sure the Hardware does not have tonnes of noise? I have written an FFT that works well the only problem is that i need something like 2048 samples before i get a responsible frequency resolution between the bins as DF = 1/(N Points/Sample Rate) so with 2048 samples and a sample rate of 300 i would get a bin resolution of 0.14Hz. and as i am measuring heart beats which range from .8hz to 3hz i need the resolution. but this means if i use the FFT as a "brick wall" filter i will have to wait > 6 seconds before i display the waveform to the user which is to slow. as this application shows the waveform as a live graph Andy
Reply by ●September 2, 20092009-09-02
On Sep 2, 1:00�pm, "Xplosiv_166" <andrew_...@msn.com> wrote:> >joepierson wrote: > >... > > >> Short the input to the hardware and preform an FFT of the noise, then > >> an FFT of the ideal signal, if frequency content overlaps no filtering > >> will help, you have to fix the hardware. �If frequency content doesn't > >> overlap the filtering you need should be apparent. > > >If the noise is relatively low-level and generally static in character, > >and you can isolate the noise in this way, spectral subtraction can work > >quite well - FFT the noise, FFT the audio in frames, and subtract the > >noise FFT from the source FFT frames. It is the basis �for a lot of > >single-ended audio noise reduction techniques. > > >Audacity has a spectral noise reduction tool that can be tried for a > >quick-n-dirty test of the principle. > > >Richard Dobson > > Hi all, > > thanks for your help > > By short the inputs you mean connect the non-inverting and inverting > inputs to the differential amplifier together to make sure the Hardware > does not have tonnes of noise? > > I have written an FFT that works well the only problem is that i need > something like 2048 samples before i get a responsible frequency resolution > between the bins as > > DF = 1/(N Points/Sample Rate) > > so with 2048 samples and a sample rate of 300 i would get a bin resolution > of 0.14Hz. and as i am measuring heart beats which range from .8hz to 3hz i > need the resolution. > > but this means if i use the FFT as a "brick wall" filter i will have to > wait > 6 seconds before i display the waveform to the user which is to > slow. > > as this application shows the waveform as a live graph > > Andy- Hide quoted text - > > - Show quoted text -You are interested in the frequency content of the heart beat itself, which is much higher then 3Hz (you have a HP filter at 3hz). I found this FFT of an heartbeat here http://www.bsignetics.com/cases/MVP.ht4.gif Your 1Khz low pass doesn't jive with your 300 sample rate, aliasing issues.
Reply by ●September 2, 20092009-09-02
On Wed, 02 Sep 2009 09:06:20 -0700, joepierson wrote:> On Sep 2, 11:19 am, "Xplosiv_166" <andrew_...@msn.com> wrote: >> Hi, >> >> I need some simple to understand filters/Filter, Basically i am looking >> at an ECG waveform and i need to clean it up. as it seems to have high >> frequency noise all over the trace. >> >> I have tried the following filter which does clean the waveform up:- >> >> float UpdateFilter(float meas, float k) { >> static float filterOutput = 0.0; >> filterOutput += k * (meas - filterOutput); return(filterOutput); >> >> } >> >> using the following site: - >> >> http://en.wikipedia.org/wiki/Low-pass_filter >> >> The problem is that it is either not cleaning the wave form enough or >> removing parts of the waveform i need. >> >> I will try and capture some unfiltered and filtered waveforms later. >> >> but i think i need either a band-pass of LP with multiple poles, but >> have not found any written in C than i can convert to Visual Basic. >> >> The Hardware starts with a 3.3Hz HP filter than is sent through an >> instrument amplifier with a gain of 1000 the output then goes through >> a 50Hz notch filter, after which is sent through another op-amp with >> variable gain (1 to 100) and DC offset. after which it is sent through >> a 1Khz LP filter then into my 10Bit ADC which is sampled at 300 times a >> second. >> >> The following diagram shows the wave form i need to fiter from the >> noise: - >> >> http://en.wikipedia.org/wiki/File:SinusRhythmLabels.svg >> >> The above filter I am using seems to work well apart from it removes >> peaks P and T from the diagram above, or simply leaves the noise on >> them. >> >> I did DSP 5 years ago at university so have forgotten most of what I >> needed a little help, as to which filter and some sample code or >> website reference, i have ordered a DSP for idiots book from amazon, so >> that may well help >> >> Thanks, >> >> Andy > > Short the input to the hardware and preform an FFT of the noise, then an > FFT of the ideal signal, if frequency content overlaps no filtering will > help, you have to fix the hardware. If frequency content doesn't > overlap the filtering you need should be apparent.ECG taint very stationary, so you'll have to select your prototype for the 'ideal' waveform carefully (I'd pick an 'ideal' pulse, trim the non- active stuff, and FFT that). -- www.wescottdesign.com
Reply by ●September 3, 20092009-09-03
On 2 Sep, 17:19, "Xplosiv_166" <andrew_...@msn.com> wrote:> The problem is that it is either not cleaning the wave form enough or > removing parts of the waveform i �need....> The following diagram shows the wave form i need to fiter from the noise:You should be very catious about this. A filter (as the term is used in the realm of DSP) *will* modify the desired transient. End of story. The problem, then, is to decide which distortions to the transient are acceptable and which are not. Remember, you want your physician to order a heart transplant based on a an actual medical condition, not because of some side effect from an arbitrary filter. Rune
Reply by ●September 3, 20092009-09-03
>On 2 Sep, 17:19, "Xplosiv_166" <andrew_...@msn.com> wrote: > >> The problem is that it is either not cleaning the wave form enough or >> removing parts of the waveform i =A0need. >... >> The following diagram shows the wave form i need to fiter from thenoise:> >You should be very catious about this. A filter (as the term >is used in the realm of DSP) *will* modify the desired transient. >End of story. > >The problem, then, is to decide which distortions to the transient >are acceptable and which are not. Remember, you want your physician >to order a heart transplant based on a an actual medical condition, >not because of some side effect from an arbitrary filter. > >Rune >Hi, Right I have a copy of the waveform for you to view, and my hardware and sample rate seem fine but my filter is no good. Below is a link to my data and filter in excel so you can see what is going on and maybe suggest a better filter than the one I have used: - http:\\www.andy166.pwp.blueyonder.co.uk/Waveform.xls Thanks, Andy
Reply by ●September 3, 20092009-09-03
On 3 Sep, 19:38, "Xplosiv_166" <andrew_...@msn.com> wrote:> >On 2 Sep, 17:19, "Xplosiv_166" <andrew_...@msn.com> wrote: > > >> The problem is that it is either not cleaning the wave form enough or > >> removing parts of the waveform i =A0need. > >... > >> The following diagram shows the wave form i need to fiter from the > noise: > > >You should be very catious about this. A filter (as the term > >is used in the realm of DSP) *will* modify the desired transient. > >End of story. > > >The problem, then, is to decide which distortions to the transient > >are acceptable and which are not. Remember, you want your physician > >to order a heart transplant based on a an actual medical condition, > >not because of some side effect from an arbitrary filter. > > >Rune > > Hi, > > Right I have a copy of the waveform for you to view, and my hardware and > sample rate seem fine but my filter is no good. > > Below is a link to my data and filter in excel so you can see what is > going on and maybe suggest a better filter than the one I have used: -I wouldn't dream of touching such a project without a) A hefty insurance, covering damages caused by my input to the project b) A cardiologist immediately available, to dicsuss how he interprets the output for any given filter. I have neither, so I'll leave it here. Rune
Reply by ●September 3, 20092009-09-03
Xplosiv_166 wrote: ...> http:\\www.andy166.pwp.blueyonder.co.uk/Waveform.xlsPWP - 404 Error This Page Cannot Be Found Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������






