LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Initialize the Smoothing Filter

Solved!
Go to solution

I'm using the "Filter" vi off the Waveform Conditioning Palette to smooth some data being collected from a fairly noisy sensor. I use it in a program that plots the Frequency Response of electromechanical actuator, and if I run it a second time with a new data set, the measurement gets distorted as if the filter isn't getting initialized, but if I stop the program and restart it works perfectly.

 

The vi doesn't offer any option to "initialize" it, and I if I try to build the function discretely, I get vastly different results.

 

Any suggestions on how I can initialize it without restarting the program?

0 Kudos
Message 1 of 10
(530 Views)

@ScottR22 wrote:

I'm using the "Filter" vi off the Waveform Conditioning Palette to smooth some data being collected from a fairly noisy sensor. I use it in a program that plots the Frequency Response of electromechanical actuator, and if I run it a second time with a new data set, the measurement gets distorted as if the filter isn't getting initialized, but if I stop the program and restart it works perfectly.

 

The vi doesn't offer any option to "initialize" it, and I if I try to build the function discretely, I get vastly different results.

 

Any suggestions on how I can initialize it without restarting the program?


Let us see some code!

 

Generally,  filter VIs do have a "reset? Input that is an "Optional" terminal default to False.  Those Optional terminals are not normally shown in the context help window!  There is a tiny icon on the lower left of the context help window that toggles the view of Optional input terminals!  😀


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 10
(502 Views)

It's an Express vi, there are no additional "Optional" terminals.

0 Kudos
Message 3 of 10
(485 Views)
Solution
Accepted by ScottR22

Hi Scott,

 


@ScottR22 wrote:

It's an Express vi, there are no additional "Optional" terminals.


So the simple solution is: don't use the ExpressVI, but use the filter functions in the signal processing palette…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 10
(482 Views)

Agree, but as I stated when I try to implement a moving average filter, I get very different results, and i would like to know what exactly is being done under the hood of this "canned" vi to make that the case?

0 Kudos
Message 5 of 10
(475 Views)

I found my mistake, this solution works.

0 Kudos
Message 6 of 10
(469 Views)

Hi Scott,

 

another option to implement a moving average:

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 10
(459 Views)

That's actually the way I first tried to implement the moving filter, but I didn't have the for loop, I just sent blocks of the waveform data into the mean function as an array, the problem is it decimated the waveform so and I forgot to update my X-Axis accordingly. Using the discrete functions you suggested from the Signal Processing palette produced the exact same results as the Express vi without the Initialization issue, so theres a bug in the Express vi for sure.

 

Thanks for you assistance.

0 Kudos
Message 8 of 10
(453 Views)

Hi Scott,

 


@ScottR22 wrote:

That's actually the way I first tried to implement the moving filter, but I didn't have the for loop, I just sent blocks of the waveform data into the mean function as an array, the problem is it decimated the waveform…


That's why I depicted the Pt-By-Pt_Mean function: it doesn't decimate the incoming data…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 9 of 10
(448 Views)

Appreciate it.

0 Kudos
Message 10 of 10
(444 Views)