12-16-2012 11:58 PM
My coworker wants to apply 1st order lag filter to a 1D array.
Is there a built-in VI or a third-party library for that?
12-17-2012 08:07 AM
I was not familiar with the term "lag filter" although I have used many kinds of filters for many years. When I Googled it I found that it is a simple weighted running average.
"
The formula for a first order lag filter is fairly simple:
new_filtered_value = k * raw_sensor_value + (1 - k) * old_filtered_value
"
I do not know of any built in VI to do that but it would be very easy to implement in a while loop with a shift register.
Lynn
12-17-2012 11:22 AM
The Control Design and Simulation Module has the functions you are looking for:
http://zone.ni.com/reference/en-XX/help/371894G-01/lvctrldsgn/construct_special_model/
This VI will design a 'transfer function' that is first-order model and you can implement using the function:
http://zone.ni.com/reference/en-XX/help/371894G-01/lvsim/sim_transferfunction/
or using the discretized version:
http://zone.ni.com/reference/en-XX/help/371894G-01/lvctrldsgn/cd_disctransfunc/
Now, if you are just looking for this specific function, you can probably just use the equation above using pure LabVIEW code. However, if your coworker wants more functions in the future, I would advice to look into more into this module.