Digital filter question [message #3002] |
Tue, 01 November 1994 03:45  |
larkum
Messages: 21 Registered: May 1993
|
Junior Member |
|
|
I can't understand description of DIGITAL_FILTER in the PV-Wave
manual. I have some data with an annoying 50Hz mains signal that
I'd like to try to filter out. The manual talks about the Nyquist
Frequency as 1/2T, where T is the time elapsed between data samples.
Well, I have data sampled at 20 kHz, so as far as I can tell,
the Nyquist frequency for this data is 10 000. Am I right?
Now what? (besides read a book on digital signal processing).
What should my low and high frequencies be to set a bandpass
filter around 50 Hz, expressing them as "fractions of the
Nyquist frequency" as "numbers between 0 and 1".
Thanks anyone,
Matthew.
____________________________________________________________ ______________
Matthew Larkum
Physiologisches Institut
Buehlplatz 5, CH-3012 Bern Switzerland
Ph. 41 31 658726 Fax. 41 31 654611
Internet: larkum@optolab.unibe.ch
matthewl@cortex.physiol.su.OZ.AU
|
|
|
Re: Digital filter question [message #3077 is a reply to message #3002] |
Fri, 04 November 1994 12:49  |
sgs
Messages: 2 Registered: November 1994
|
Junior Member |
|
|
MEL (larkum@optolab.unibe.ch) wrote:
: I can't understand description of DIGITAL_FILTER in the PV-Wave
: manual. I have some data with an annoying 50Hz mains signal that
: I'd like to try to filter out. The manual talks about the Nyquist
: Frequency as 1/2T, where T is the time elapsed between data samples.
: Well, I have data sampled at 20 kHz, so as far as I can tell,
: the Nyquist frequency for this data is 10 000. Am I right?
: Now what? (besides read a book on digital signal processing).
: What should my low and high frequencies be to set a bandpass
: filter around 50 Hz, expressing them as "fractions of the
: Nyquist frequency" as "numbers between 0 and 1".
For 20khz sample rate, the Nyquist frequency is 10khz, and the fraction
of nyquist frequency for 50 Hz is 50./10000. For a notch filter try
using:
freqlow = 55./10000. ; (note that high and low are reversed for notch)
freqhigh = 45./10000.; (and in order for bandpass)
Be sure to specify enough filter coefficients. I like to increase N and
refilter until the filtered data stops changing. The lower the
frequencies kept, the more coefficients needed. If you use an fft to
filter, rather than convolution, you can use a huge N with good cpu
performance. A good reference is "Numerical Recipies in C".
Steve Spray sgs@lmsc.lockheed.com
|
|
|
Re: Digital filter question [message #3082 is a reply to message #3002] |
Fri, 04 November 1994 06:25  |
alps
Messages: 4 Registered: October 1994
|
Junior Member |
|
|
In <CypD06.7tD@festival.ed.ac.uk> soc@festival.ed.ac.uk (Stephen O'Connell) writes:
> MEL (larkum@optolab.unibe.ch) wrote:
> : I can't understand description of DIGITAL_FILTER in the PV-Wave
> : manual. I have some data with an annoying 50Hz mains signal that
> : I'd like to try to filter out. The manual talks about the Nyquist
> : Frequency as 1/2T, where T is the time elapsed between data samples.
> : Well, I have data sampled at 20 kHz, so as far as I can tell,
> : the Nyquist frequency for this data is 10 000. Am I right?
> : Now what? (besides read a book on digital signal processing).
> : What should my low and high frequencies be to set a bandpass
> : filter around 50 Hz, expressing them as "fractions of the
> : Nyquist frequency" as "numbers between 0 and 1".
> : Thanks anyone,
> I havent used the routine but I expect your 50Hz is just 50/10000
I he is right, except for the part that ..................^^^^^^^^^
should be 50/2*10000 and similary for the bandpass...
> so that the two numbers setting the low and high are 49.5/10000 and
> 50.5/10000 for a bandpass of 1Hz centered on 50Hz..ie 4.95e-3 and
> 5.05e-3
> Hope this helps...
Alps
> : Matthew.
> : ____________________________________________________________ ______________
> : Matthew Larkum
> : Physiologisches Institut
> : Buehlplatz 5, CH-3012 Bern Switzerland
> : Ph. 41 31 658726 Fax. 41 31 654611
> : Internet: larkum@optolab.unibe.ch
> : matthewl@cortex.physiol.su.OZ.AU
|
|
|
Re: Digital filter question [message #3092 is a reply to message #3002] |
Thu, 03 November 1994 09:38  |
soc
Messages: 12 Registered: October 1994
|
Junior Member |
|
|
MEL (larkum@optolab.unibe.ch) wrote:
: I can't understand description of DIGITAL_FILTER in the PV-Wave
: manual. I have some data with an annoying 50Hz mains signal that
: I'd like to try to filter out. The manual talks about the Nyquist
: Frequency as 1/2T, where T is the time elapsed between data samples.
: Well, I have data sampled at 20 kHz, so as far as I can tell,
: the Nyquist frequency for this data is 10 000. Am I right?
: Now what? (besides read a book on digital signal processing).
: What should my low and high frequencies be to set a bandpass
: filter around 50 Hz, expressing them as "fractions of the
: Nyquist frequency" as "numbers between 0 and 1".
: Thanks anyone,
I havent used the routine but I expect your 50Hz is just 50/10000
so that the two numbers setting the low and high are 49.5/10000 and
50.5/10000 for a bandpass of 1Hz centered on 50Hz..ie 4.95e-3 and
5.05e-3
Hope this helps...
Rob
: Matthew.
: ____________________________________________________________ ______________
: Matthew Larkum
: Physiologisches Institut
: Buehlplatz 5, CH-3012 Bern Switzerland
: Ph. 41 31 658726 Fax. 41 31 654611
: Internet: larkum@optolab.unibe.ch
: matthewl@cortex.physiol.su.OZ.AU
|
|
|