ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

Bandpass Zero phase Filtering

I tried implementing zero phase filter for filtering noisy EEG signals.

It is behaving like a bandstop filter when tried bandpass mode.

but bandstop, HPF, LPF are working properly.

I tried cascading of ZPHPF & ZPLPF but it also didn't work.

What would be the problem with my VI?

0 Kudos
Message 1 of 4
(4,400 Views)

It appears that the typecast function in Zero Phase Filter.vi is sending the wrong information to Butterworth Coefficients.vi.  I placed U32 numeric indicators on the Type output of the Unbundle and on the output of the typecast. 

Type Unbundle  Typecast out

Lowpass   0            0

Highpass  1            3

Bandpass 2            3

Bandstop  4            3

 

That may not be the only problem however. When I bypassed the typecast, I still get NaN outputs for both bandpass and bandstop filters.

 

ZPFilter.png

 

Why are you sampling at 500 kHz and then resampling to a much slower rate?  When I apply the same filter specifications to the raw data, I get the results shown below.

 

Filtered data.png

 

This was using Digital IIR Filter.vi from the Waveform Conditioning palette (LV2015). I am not sure whether the filter VIs have changed since LV 2011.

 

Why are you worried about a zero phase filter? The spectrum of the raw signal appears to be essentially random.

 

Phase.png

 

Lynn

Message 2 of 4
(4,381 Views)

 

Numeric filter don't like to have a 500kHz Samplerate and a filtersetting of 1Hz to 45Hz.

Think of a 1Hz sine sampled at 500kHz and a 4th order filter. the coefficients will scrap at the lower end of the numerical resolution ....  add noise and the filter is quickly lost 😄

Decimate (with filter) to 500Hz samplrate and try again 😉

 

Another way to compensate the filter phase of  finite samples is  to filter twice with reversed data.

data -> filter -> reverse data -> filter - reverse data

Greetings from Germany
Henrik

LV since v3.1

“ground” is a convenient fantasy

'˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'


0 Kudos
Message 3 of 4
(4,371 Views)

Hi Lynn & Henrik,

 

I got a problem in calcualation of percentatge of similarity between two EEG signals which are acquired by diffent type of electrodes  by using correlation technique. I tried avearaging the data 500Khz at 1000 samples also.

I believe that i am not getting the correct value of percentage.

I am auto correlating the referance signal and maximum of autocorrelation was found out.

similarly  i am crosscorrelating the referance signal with test signal and finding out the maximum.

from those two vaues i am tryoing to find out percentage of similarity.., is it correct aproach??

Please lookinto the attached VI.

0 Kudos
Message 4 of 4
(4,266 Views)