"abradley1984" <abradley1984@gmail.com> wrote in
news:s-OdnS-9Z53OuSfVnZ2dnUVZ_uCdnZ2d@giganews.com:

>>Vladimir Vassilevsky <antispam_bogus@hotmail.com> wrote in
> news:OWduk.25815
>>$Ri.11814@flpi146.ffdc.sbc.com:
>>
>>> Although 25kHz for EEG is definitely an overkill.
>>
>>
>>Is that what Interneural Recordings are?? If so, the frequency range
>>of
>
>>interest goes to about 100Hz, so 500Hz should be all you need.
>>--
>>Scott
>>Reverse name to reply
>>
> It's not EEG, I'm obviously no explaining myself very well. I'm
> basically sticking a microelectrode into the nerve and recording from
> that. So I need higher frequencies to see the spikes.

Do you JUST need to see the spikes, or do you need more information than
that? Do you need to distinguish one type of spike from another?? Do
you need to recover the resting membrane potential??
Given what you're doing, your sample rate isn't so crazy. Try HIGH PASS
FILTERING at about 150 Hz cutoff, and see if the result is acceptable.
No need for a tight old notch filter when you don't particularly care
about the low frequency stuff.
Since the noise seems to be in your soundbooth, any Faraday cage built
into the walls isn't helping you. You'd need a cage around your
physiology.
--
Scott
Reverse name to reply

Reply by abradley1984●August 31, 20082008-08-31

So: My efforts with Matlab filters failed. I can't get a notch filter
with a small enough bandwidth for my purposes, even with the signal
decimated by 4 to a Fs of 6250.
Maybe someone else could do better.
I also tried the correlation subtraction method to no avail.
Finally, I decided to leave the 60Hz in. I don't think it's interfering
with any useful data, it just makes my graphs look bad. I don't think it's
worth distorting important information to remove it.
Thanks again for everyones help. I've learned a lot in the last few days,
hopefully I can apply it some time in the future.
Allison

>>"abradley1984" <abradley1984@gmail.com> wrote in
>>news:AsGdnV6jK46fsiXVnZ2dnUVZ_hWdnZ2d@giganews.com:
>>
>>>
>>> I'm aware of the harmonics of 60Hz, which I'm ignoring for now

because

>>> I'm really only looking at frequencies up to 100Hz at the minute.
>>> And in case your interested, it's recorded data, interneural
>>> recordings, and I did my utmost to avoid noise during recording.
>>
>>
>>That's different. The first question is "what are you trying to do.
>
>I'm looking at the neural firing pattern, so I need higher frequency

info

>to see the spikes. However I"m applying stimulation at 10-50Hz, and

need

>to see if there's a response at this range .
> If
>>its identify spikes, you might consider high-pass filtering instead of
>>trying to notch out your line noise. If you really really need the
>>waveform, and it has real info in the 50-60 Hz range, you might want to

>>reconsider. If I were refereeing, I wouldn't like it. Does "utmost"
>>include Faraday cage?
>>
>
>Utmost includes a sound proof booth, which I think includes a faraday
>cage.
>
>>To decimate, you need to low-pass filter first, and you might lose some

>>valuable signal.
>>
>>Another quick and dirty trick would be to FFT, zero out the 60 Hz
>>component, and then ifft. If it doesn't work, you haven't wasted much
>>time.
>>--
>>Scott
>>Reverse name to reply
>>
>

Reply by abradley1984●August 31, 20082008-08-31

>"abradley1984" <abradley1984@gmail.com> wrote in
>news:AsGdnV6jK46fsiXVnZ2dnUVZ_hWdnZ2d@giganews.com:
>
>>
>> I'm aware of the harmonics of 60Hz, which I'm ignoring for now because
>> I'm really only looking at frequencies up to 100Hz at the minute.
>> And in case your interested, it's recorded data, interneural
>> recordings, and I did my utmost to avoid noise during recording.
>
>
>That's different. The first question is "what are you trying to do.

I'm looking at the neural firing pattern, so I need higher frequency info
to see the spikes. However I"m applying stimulation at 10-50Hz, and need
to see if there's a response at this range .
If

>its identify spikes, you might consider high-pass filtering instead of
>trying to notch out your line noise. If you really really need the
>waveform, and it has real info in the 50-60 Hz range, you might want to
>reconsider. If I were refereeing, I wouldn't like it. Does "utmost"
>include Faraday cage?
>

Utmost includes a sound proof booth, which I think includes a faraday
cage.

>To decimate, you need to low-pass filter first, and you might lose some
>valuable signal.
>
>Another quick and dirty trick would be to FFT, zero out the 60 Hz
>component, and then ifft. If it doesn't work, you haven't wasted much
>time.
>--
>Scott
>Reverse name to reply
>

Reply by abradley1984●August 31, 20082008-08-31

>Vladimir Vassilevsky <antispam_bogus@hotmail.com> wrote in

news:OWduk.25815

>$Ri.11814@flpi146.ffdc.sbc.com:
>
>> Although 25kHz for EEG is definitely an overkill.
>
>
>Is that what Interneural Recordings are?? If so, the frequency range of

>interest goes to about 100Hz, so 500Hz should be all you need.
>--
>Scott
>Reverse name to reply
>

It's not EEG, I'm obviously no explaining myself very well. I'm basically
sticking a microelectrode into the nerve and recording from that. So I
need higher frequencies to see the spikes.

Reply by Scott Seidman●August 30, 20082008-08-30

Vladimir Vassilevsky <antispam_bogus@hotmail.com> wrote in news:OWduk.25815
$Ri.11814@flpi146.ffdc.sbc.com:

> If this is the recorded data, you can just subtract the unwanted signal
> from it.
>

Easy to say, harder to do. The noise can change with any movement, in my
experience. Even the impedance plethysmography signal can change the size
of the noise with breathing. You can mess around a good long time before
you realize you can only do so much with correlation/subtraction methods.
--
Scott
Reverse name to reply

Reply by Scott Seidman●August 30, 20082008-08-30

Vladimir Vassilevsky <antispam_bogus@hotmail.com> wrote in news:OWduk.25815
$Ri.11814@flpi146.ffdc.sbc.com:

> Although 25kHz for EEG is definitely an overkill.

Is that what Interneural Recordings are?? If so, the frequency range of
interest goes to about 100Hz, so 500Hz should be all you need.
--
Scott
Reverse name to reply

Reply by Vladimir Vassilevsky●August 30, 20082008-08-30

abradley1984 wrote:

> I think my problem is that I'm being lazy, and trying to implement the
> filter straight in matlab using a butterworth filter.

Being lazy is a serious problem. There is no solution to it.

> After listening to your advice I realised I need to think a bit more about
> IIR filters, so I went to Matlab help, which gave me this advice:
>
> "All classical IIR lowpass filters are ill-conditioned for extremely low
> cut-off frequencies. Therefore, instead of designing a lowpass IIR filter
> with a very narrow passband, it can be better to design a wider passband
> and decimate the input signal."

This looks like a meaningless set of adjectives and global assertions.
The loss of numeric precision at low frequency (Fc/Fs <<< 1) in a direct
form biquad is at the order of Q*(Fc/Fs)^2. In your case, the losses are
going to be about 14 bits or so. You will definitely be fine with the 32
bit integer or the double precision float. Besides, there are the
methods to improve the precision (state variable filters, noise shaping
and such).

> Which I'm presuming means down sample? I can afford to down sample, so I
> think I should do that.

You don't have to. Although 25kHz for EEG is definitely an overkill.

> I'm aware of the harmonics of 60Hz, which I'm ignoring for now because I'm
> really only looking at frequencies up to 100Hz at the minute. And in case
> your interested, it's recorded data, interneural recordings, and I did my
> utmost to avoid noise during recording.

If this is the recorded data, you can just subtract the unwanted signal
from it.
Vladimir Vassilevsky
DSP and Mixed Signal Design Consultant
http://www.abvolt.com

Reply by Steve Pope●August 29, 20082008-08-29

abradley1984" <abradley1984@gmail.com> wrote,

> I'm aware of the harmonics of 60Hz, which I'm ignoring for now because
> I'm really only looking at frequencies up to 100Hz at the minute.
> And in case your interested, it's recorded data, interneural
> recordings, and I did my utmost to avoid noise during recording.

In this case I would remove the 60 Hz fundamental and
its second harmonic (and probably, the third harmonic) by a
correlation/subtraction approach, and filter down to 100 Hz bandwidth
with a fairly low-order filter (3rd - to 6-th order, I would say).
On this dataset a Hamming window of length around 10 * (1 / 60Hz)
prior to correlation would be about right.
I'd avoid high-Q notch filters, higher-order low-pass filters, or
sample rate conversion as these will merely distort your data
and are not necessary for your problem. Trying to filter out
the 120 Hz component with a sharp LPF when there is signal of interest
up to 100 Hz is not very attractive.
Steve

Reply by Scott Seidman●August 29, 20082008-08-29

"abradley1984" <abradley1984@gmail.com> wrote in
news:AsGdnV6jK46fsiXVnZ2dnUVZ_hWdnZ2d@giganews.com:

>
> I'm aware of the harmonics of 60Hz, which I'm ignoring for now because
> I'm really only looking at frequencies up to 100Hz at the minute.
> And in case your interested, it's recorded data, interneural
> recordings, and I did my utmost to avoid noise during recording.

That's different. The first question is "what are you trying to do. If
its identify spikes, you might consider high-pass filtering instead of
trying to notch out your line noise. If you really really need the
waveform, and it has real info in the 50-60 Hz range, you might want to
reconsider. If I were refereeing, I wouldn't like it. Does "utmost"
include Faraday cage?
To decimate, you need to low-pass filter first, and you might lose some
valuable signal.
Another quick and dirty trick would be to FFT, zero out the 60 Hz
component, and then ifft. If it doesn't work, you haven't wasted much
time.
--
Scott
Reverse name to reply

Reply by Jerry Avins●August 29, 20082008-08-29

abradley1984 wrote:
...

> Thank you all for your helpful advice, it's nice to hear from people who
> clearly know a lot more than me!
>
> I think my problem is that I'm being lazy, and trying to implement the
> filter straight in matlab using a butterworth filter.
>
> After listening to your advice I realised I need to think a bit more about
> IIR filters, so I went to Matlab help, which gave me this advice:
>
> "All classical IIR lowpass filters are ill-conditioned for extremely low
> cut-off frequencies. Therefore, instead of designing a lowpass IIR filter
> with a very narrow passband, it can be better to design a wider passband
> and decimate the input signal."

Note the reference to lowpass. I don't think that applies to notch
filters, unless by "ill conditioned" they have in mind the numerical
issues that Tim Wescott raised.

> Which I'm presuming means down sample? I can afford to down sample, so I
> think I should do that.

It does and you should. In the process, you might use a low pass filter
that cuts out the 120 Hz noise.

> I'm aware of the harmonics of 60Hz, which I'm ignoring for now because I'm
> really only looking at frequencies up to 100Hz at the minute. And in case
> your interested, it's recorded data, interneural recordings, and I did my
> utmost to avoid noise during recording.

May I respectfully submit that your utmost could probably be improved
upon? Consider how clean EEG and EKG traces can be.

> So I'm going to try downsampling and see if that works, and if not I'll go
> back and study up on filter design and implementation.

Good luck!

> Thanks again for all your help!

Keep in touch.
Jerry
--
Engineering is the art of making what you want from things you can get.
�����������������������������������������������������������������������