LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I implement "zero phase filter" in labview?

I have used function, 'filtfilt' which is zero phase filter in Matlab and would like to implement in Labview. I tried to generate DLL and used Call Libration Function in labview but it didn't work. Anyone suggestion about implementation method or equivalent way would be highly appreciated.
Message 1 of 20
(10,214 Views)
I used the zero-phase method in the past in LabVIEW for post-processing purposes.
Just digital filter your input-data array from beginning to end =i()
Then, run the same dig. filter with the data reversing (end to beginning)= ii()
Reverse ii() and add to i()filtered array, divide by 2 and voila zero-phase filter.

Patrick de Boevere
0 Kudos
Message 2 of 20
(10,216 Views)
AS an additional note;

the zero-phase shift method get the filetered back in phase but you end up with "edge effects" at both the start and the end.

Toss (or ignore) as many samples as the order of the filter when done.

I would be interested in hearing how others have handled these edge-effects.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 20
(10,217 Views)
My understanding is that you've got to throw out the start and end points (unless your filtering vi does it for you). They are useless.

There's an excellent text online entitled "The Scientist & Engineer's Guide to Digital Signal Processing". It's very readable for the non-EE. Read Chapter 6 on Convolution (which is what a digital filter is).
http://www.analog.com/technology/dsp/training/materials/dsp_book_index.html

~Tim
0 Kudos
Message 4 of 20
(10,217 Views)
I may be confused on how you described this, but I don't think you want to simply add the filtered signal and filtered reversed signal.  If you do that then you are filtering the signal with the real part of the filter frequency response.  The way it is done in matlab is to filter the sequence, reverse the filtered sequence, filter again, and reverse again.  Additionally as other people were mentioning there are issues with transients that Matlab has some tricks to deal with.
Message Edited by KSurender on 11-19-2009 01:28 PM
0 Kudos
Message 5 of 20
(9,523 Views)

If you are using an IIR filter that introduces phase distortion, you would need to reverse the filtered data and filter it again to get zero phase filtering.  With a FIR filter and convolution, there is no need for the second filtering.  Any symmetric FIR filter is by definition a zero phase filter.  Just shift the data back by half the filter width after filtering and it will match the phase of the original signal exactly.

 

I also agree you have to throw out the data at the ends.  The FIR convolution adds 1/2 of the filter width at each end, and you need to throw out 1 filter width at each end.  When filtering it is always important to have some extra data at each end.

 

If you are really attached to IIR filters, the Bessel filter has an almost linear phase shift in the data.  This is equivalent to a constant time delay and a zero shift filter.  You can shift the data back a fixed number of samples just like the FIR filter.

 

Bruce

Bruce Ammons
Ammons Engineering
Message 6 of 20
(9,490 Views)
Just a note that this thread is 7 years old.
Jarrod S.
National Instruments
0 Kudos
Message 7 of 20
(9,481 Views)

I hate when that happens.  The original poster hasn't even visited the forums since two days after his post.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 8 of 20
(9,479 Views)
Yea I guess this thread is pretty old but it's one of the first hits when you google labview filtfilt.  Anyways, Labview has a zero-phase filter in the signal processing toolbox.  Just wire the same coefficients to the reverse and forward coefficients of the vi. 
Message 9 of 20
(9,409 Views)
I second KSurender's point on first hits. That's exactly what just happened to me. Here's the link to the LabVIEW 2009 Help documentation on the Zero Phase Filter.
0 Kudos
Message 10 of 20
(8,943 Views)