LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Lab View filter delay, and lining up with the original signal.

I am trying to understand filtering in LabVIEW, and filtering in general.  I am reading data into an array. I keep the last X samples in the array, so I only keep the last 15 seconds of data in the array.  I pass the data through an FIR windowed Filter and I calculate the delay.   Why is the filtered array size larger than my input array (3000 for input array 3050 for the output array if I have 50 taps)?  It looks like that the first 25 ([#taps-1]/2) and last 25 can be discarded then I have a filtered array of my measurment.   When comparing it to the original array, I figured I would have to delay the original data before being able to match up the data, but it appears that I just subtract the delay from the filtered array and the two arrays seem to be in sync.   So my question is what is being done?  My thought was that any delay would be a time delay, but my vi seems to keep up even for a high number of taps.  For the first point in the array are the taps being used all the lower points of the array (what ever number of Taps I specify)?    For the last point in my original array are they all the higher array points?  How are the taps determined for the middle points? 

0 Kudos
Message 1 of 2
(3,212 Views)

Hi baldThunder,

 

To answer your first question as to why the output array is larger than the input array, filtering involves the convolution of 2 arrays where the second array is the taps of the filter, so the output is always going to be size(array) + (# of taps) - 1.  So in your case, your final array size should be 3000 + 50 - 1 = 3049.

 

To answer your second question as to the delay:  Given a FIR filter which has N taps, the delay in terms of samples is: (N - 1) / (2), or if you want the delay in terms of time, it is  (N - 1) / (2 * Fs) where Fs is the sampling frequency.  So by removing the first (N-1)/2 elements of the filtered array, you are actually removing the delay, resulting in the original signal.  Of course the output signal will still have an extra (N-1)/2 elements added on to the end of it still.

 

I don't quite understand what you are asking in your last 3 questions, but hopefully the above 2 answers help clarify things for you.

 

I would recommend you take a look at the FIR Windowed Filter Design example in LabVIEW.  I added an Array Size function to the input and output arrays of the FIR Windowed Filter function and was able to observe the size behavior I described above, and you can also play around with different numbers of taps and see how it affects the filter.

 

http://zone.ni.com/reference/en-XX/help/371361H-01/lvanls/fir_windowed_filter/

 

Also, check out some web resources to get some more info on how FIR filters work.  Here is one I found:

 

http://www.dspguru.com/dsp/faqs/fir/basics

 

Have a nice day!

Andrew T.
National Instruments
Message 2 of 2
(3,189 Views)