From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Format expected by FIR Filter.vi

I tried using the FIR Filter.vi with coefficients calculated in Matlab and the results were not what I expected.

I tried using the same variables to build FIR Narrowband Coefficients VI. it produced different coefficients which can be expected. But it was 20 coefficients instead of 165.

fir1Sps.txt was from Matlab.

 

So I am abandoning making the FIR filter coefficients in Labview.

I will try again to use the FIR Filter.vi

 

Does the FIR Filter.vi remove the first N values from X. Where N is the number of coefficients.

What format does FIR Filter.vi expect the coefficients in? 

0 Kudos
Message 1 of 4
(2,365 Views)

@BeanBoy wrote:

 

Does the FIR Filter.vi remove the first N values from X. Where N is the number of coefficients.

What format does FIR Filter.vi expect the coefficients in? 



FIR Stands for Finite Impulse Response.  N is the number of samples needed to steady the filter output when the signal is first applied.   so, the Nth+1 value is the first filtered value.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 4
(2,352 Views)

Thanks for the explanation. But I still am not clear.

 

In the output will I see X[0] to X[N] or will the filter discard them for me. The decimation tool does keep the first value. So if my filter has 200 coefficents and I am decimating by 10. Then do I need filter then remove the first 200 samples out of the filter then use Decimate (single shot) VI to decimate by 10?

filterSnippet.png

0 Kudos
Message 3 of 4
(2,342 Views)

What Matlab code did you use to get the coefficients?

 

It looks like you are specifying a lowpass filter with near unity gain at 40 Hz and very low sideband at 1960 Hz.  In LV you will have to specify a cutoff frequency instead, probably in the 800-900 Hz range.  For a window you probably want one tweaked for low sidebands, I think there is one called low sidelobe or something like that in the LV vi.  You should be able to match the coefficients pretty closely if you choose a lowpass filter with 165 taps, cutoff ~800 Hz, Sampling Freq = 30000 Hz, scaling, and the low sidelobe window (or similar).  If I get to LV I will check it out.

 

When you apply the filter you get out the same number of points you put in.  The finite response time comes with the territory for FIR filters, if you are breaking up a large time series into chunks, just be sure to only initialize during the first call to the function.  The =0 comparison on a loop iteration terminal is very handy here.  If it is one big series then you may want to chuck out the first N points.

0 Kudos
Message 4 of 4
(2,335 Views)