Forums

change a dsp filter for varios sampling frequency

Started by emilly August 30, 2005
Dear all
i have a digital filter H(Z)=1/32*(1-z^-6)^2 /(1-z^-1)^2
with sampling rate being 200Hz, the filter has a rather loe cutoff frequency of fc Hz and introduces a delay of 5 sample or 25ms.this filter provides an attenuation greater than 25dB at 60Hz,and effectively suppresses power-line interference,if present.

i make this filter in MATLAB with command:
y(n) = 2*y(n-1)-y(n-2)+1/32*(x(n)-2*x(n-6)+x(n-12)); now how can i change this filter to give same answer at other sampling rate like 500Hz, which the cutoff 11Hz and 25dB at 60Hz dont change

Thanks in advance
emilly


This post is in response to a private email I got, but I thought maybe others would like to know the answer:
 
From: Reshma Jacob
Sent: Saturday, September 03, 2005 10:40 AM
To: Egler, Mark
Subject: RE: [matlab] change a dsp filter for varios sampling frequency

Mark,
I thought all recursive filters r IIR?can u please explain..i am still new to DSP..
Thanx,
Reshma

Reshma,
The two terms are often thought to be equivalent, but they are not. All IIR filters are recursive, but not all recursive filters are IIR. "Recursive" refers to the use of previous output samples or intermediate variables in the filter difference equation, similar to feedback in analog designs. "Non-recursive" means only current and previous input samples are used. "Infinite Impulse Response" (IIR) means that the impulse response never reaches  a non-zero steady state (at least with infinite precision arithmetic). This is often the case with recursive filters, but not always.  "Finite Impulse Response" means that the impulse response has only a finite number of non-zero samples.
 
In the particular case Emilly presented, the filter is an FIR, but because the impulse response is just a simple triangle, it can be realized as a recursive filter. To do this, just take the second-derivative (second-difference, actually) of the triangle, giving the (1 -z^-N)^2 numerator in the Z-transform, and then integrate twice, giving the denominator. You can use this trick to implement a piece-wise-linear approximation of a more general impulse response, and reduce the amount of computation by using recursion (notice there are no multiplications except by 2 and 1/32, which are just binary shifts).
 
This sort of thing was a big deal back when DSP was done on slow-multiplying CPUs or limited hardware implementations ( I think the Pan-Tompkins alg was implemented on one of the earliest 8086 PCs). For today's DSP processors, there's probably no reason to do this, since they are optimized for non-recursive FIR filter implementation.
 
Mark


"Egler, Mark" <m...@analogic.com> wrote:
Emilly,
I guess you're doing some work with ECG based on your sample rate. I think I recognize the filter, too. Is it from Willis Tompkins book ? Anyway, what you want to do to convert the filter to a different sample rate without changing its absolute cutoff freq., etc. is to interpolate the filter's impulse response by a 500/200 ratio. This may look difficult but it's actually quite easy in this case. This particular filter is recursive but is not an IIR, its impulse response is actually just a triangle with 2N-1 non-zero samples, where N=6. It's really an FIR, but recursive. To interpolate, all you need to do is change N to 6*500/200 = 15. The 1/32 gain adjustment needs to change, too. I'll leave that to you.
 
BTW, if you really wanted to suppress 60 Hz, this isn't the best filter, since it doesn't have a zero at or near 60 Hz (well, 66.7 Hz isn't very near).
 
Mark


From: m...@yahoogroups.com [mailto:m...@yahoogroups.com] On Behalf Of emilly
Sent: Tuesday, August 30, 2005 10:51 AM
To: m...@yahoogroups.com
Subject: [matlab] change a dsp filter for varios sampling frequency

Dear all
i have a digital filter H(Z)=1/32*(1-z^-6)^2 /(1-z^-1)^2
with sampling rate being 200Hz, the filter has a rather loe cutoff frequency of fc Hz and introduces a delay of 5 sample or 25ms.this filter provides an attenuation greater than 25dB at 60Hz,and effectively suppresses power-line interference,if present.

i make this filter in MATLAB with command:
y(n) 2*y(n-1)-y(n-2)+1/32*(x(n)-2*x(n-6)+x(n-12));now how can i change this filter to give same answer at other sampling rate like 500Hz, which the cutoff 11Hz and 25dB at 60Hz dont change

Thanks in advance
emilly           
****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to D...@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

__________________________________________________

****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to D...@analogic.com - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.