LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What does the "option" input of the FIR Windowed Coefficients VI do?

Solved!
Go to solution

Here's the LV Help entry:


option specifies whether to scale the FIR Windowed Coefficients. The default is 0.

  • 0 not scaled—Does not scale the FIR Windowed Coefficients.
  • 1 scaled—Scales the FIR Windowed Coefficients.

 

Well that's....unhelpful. Scales them by what? Why?

0 Kudos
Message 1 of 10
(3,683 Views)

Hi David,

 

When the value is set to false, the coefficients are set to zero. This is the way you would want to run the VI if you have all your data already and just need to send it through this VI. Setting it to true saves the coefficients so if you had some kind of loop running, the next set of data you send through goes through the filter starting at the end of the previous coefficients. So if you were at the 31st coefficient when the VI ended, the next set of data that you sent through would start at the 32nd coefficient. This is useful if you are sampling data and don't have the entire signal to process at once. 

 

Thank you,

Kurt P
Automated Test Software R&D
0 Kudos
Message 2 of 10
(3,654 Views)

Kurt, I don't understand your response. I'm looking at the VI's block diagram, and in the "not scaled" case the coefficients are not set to 0; they're passed out without being divided by some other polynomial. (If they were all set to 0, the filter would pass nothing.) Additionally, there's no "saving" initial and final state conditions in this VI; it doesn't execute on the data, it just defines the filter that will execute on it.


I hate to ask this, but are you sure you were looking at NI_AALBase.lvlib:FIR Windowed Coefficients.vi?

 

0 Kudos
Message 3 of 10
(3,637 Views)

Sorry, you are correct. I was looking at the data for FIR Filter.vi.

 

For this one, if you double click the VI icon (this tip works for most VIs with white backgrounds) you can bring up the block diagram for that VI. In this, you can see that when the value is "not scaled" the VI produces coefficients based on the "FIR Windowed (uniform) Filter coeficient.vi" which then passed them to the "symmetric filter.vi".

 

When the filter is “scaled”, then the program goes through a different process depending on the type of filter. When it is a low pass filter, the end coefficients are scaled by the sum (Coef/Sum). In the high pass filter, it weights the coefficients based on a ramp function and then sends them through an exponential so that looks like:

 

coef / abs (sum (exp(ramp*-i*pi*0.5)*coef)). 

 

In short, the coefficients are scaled by themselves and/or the cutoff frequencies (in the case of the bandpass filter)

 

Hope this helps,

Kurt P
Automated Test Software R&D
0 Kudos
Message 4 of 10
(3,599 Views)

Unfortunately, it doesn't help. All you've done is read the block diagram to me. Could you (or someone who knows this function) please explain why a person would choose to scale the coefficients this way or not? I don't think I need a primer in filter design, but I still haven't heard an explanation for what effect the scaling formula has on the filter, why that formula is used, etc. Does it result in unity gain? Does it ensure linear phase? Something else?

0 Kudos
Message 5 of 10
(3,595 Views)

Hi David, 

 

Normally in the LabVIEW detailed help for a VI there is a reference to some kind of reference material that cites where the equation is from. For some reason, that is not the case with this VI. I am currently in the process of tracking that down so I can get the information for you. 

 

Thank you,

Kurt P
Automated Test Software R&D
0 Kudos
Message 6 of 10
(3,565 Views)

I do not use the NI VIs, but I can make an educated guess using the provided BD description.

 

The 'F' in FIR stands for Finite, and you are making an approximation to the corresponding Infinite Impulse Response filter.  Your window function is effectively zeroing out the impulse response outside of the finite region (ie. truncates the series to a finite number of taps).  Normally, the values which are truncated are quite small (otherwise it would not be a useful procedure).  They are however, non-zero, and therefore the simple FIR approximation would have a slightly different equivalent noise bandwidth than the IIR filter you are approximating.  You can scale the coefficients so these bandwidths are equal, I assume that is what the scaling option is doing.

 

If my guess is correct, the correction should be small, and it should be smaller with more taps.  (If I had to guess I would suggest that the scale correction is a small oscillation around 1 since it should resemble the behavior of the Sinc(x) function).

 

Or I could be way off base.

0 Kudos
Message 7 of 10
(3,552 Views)
Solution
Accepted by David_Staab

Hey David,

 

I was able to get in contact with some more engineers. The scaled coefficients will give you exact 0dB gain on the DC for Lowpass/Bandstop or exact 0dB gain on nyquist frequency for Highpass/Bandpass. While, un-scaled coefficients don't provide this characteristic. That's to say, if the you have 0dB gain requirement for DC/nyquist frequency of the type of filter, you should choose scaled option. Otherwise, stay with not scaled option.

 

Thanks,

Kurt P
Automated Test Software R&D
0 Kudos
Message 8 of 10
(3,536 Views)

Thanks Kurt! Unity gain at DC is indeed a requirement in my application.

0 Kudos
Message 9 of 10
(3,532 Views)

While you have the engineers attention could you ask the following.  I understand the equivalence of unity gain and total effective bandwidth, it is simply two sides of the equation for the zero frequency component of the DFT.

 

I roll my own version of these VIs, and I have the lowpass/bandstop and highpass/bandpass correspondence that you mention.  Why is then that the NI version gives two different scale factors for the highpass filter and the equivalent bandpass filter (upper cutoff = nyquist frequency)? 

 

Thanks.

0 Kudos
Message 10 of 10
(3,519 Views)