02-12-2021 01:56 AM
Hello,
I want to form the Integral from an acceleration signal I receive to get the velocity. This is how I've done it so far:
I receive the data in blocks of 9600 entries per 100 ms as an array so in sum 96.000 entries per second.
First I use a bandpassfilter to adjust the signal from the sensor offset: Sampling frequency 96.000, frequency range from 1 to 10.000 (This describes the linear range of the sensor. I also set init/cont to true, so LabVIEW initializes the internal states to the final states to filter the signal, otherwise I would receive a sawtooth wave. This works fine.
In the next step I use Integral x(t).vi to get the velocity signal. I set the sampling interval dt to 1 / 9.600. Unfortunately this vi doesn't have the init/cont input from the Butterworth Filter.vi so I get a leap to zero after each array of 9.600 entries. This is how it looks:
I already tried to use the last entry of the array to make it the Initial Condition of Integral x(t).vi but as you can see this didn't make any difference.
Does anyone know how I can get a clean integral?
Best regards
Lukas
Solved! Go to Solution.
02-12-2021 11:44 AM
Pictures are insufficient to help you. Please attach a simplified VI containing some data.
02-12-2021 02:44 PM
Sure, attached you find the simple vi and a text file with recorded data, that I use in the first loop of the vi to simulate the data acquisition from the device, from which I receive blocks of data with 9600 entries per 100 ms.
It's for LabView Version 20
02-12-2021 04:44 PM - edited 02-12-2021 04:45 PM
You have so much noisy data, that fancy integration algorithms can be replaced by simple summing (you'll get the same as with the ptbypt, another alternative). Note that your data has the steps while both the ptbypt and simple summing does not.
Do you really want to do bandpass filtering? Doesn't that also remove DC components that might be interesting? Not sure, but look into it.
(Frankly, I never really bothered with the initial and final condition settings of integration because I don't understand them. Maybe somebody else can enlighten us)
I reduced the history length of the various charts to five datasets. (Some of your charts were set to 32M(!!) DBL points, which is crazy! Maintaining a quarter GB buffer per chart seems unreasonable, even more so if the charts are only a few hundred pixels wide 😮 ). Front panel elements are not for massive data storage. Data belongs on the diagram!
02-12-2021 05:31 PM
OK, when you read the help between the lines, the last elements needs to be multiplied by 6/dx (Simpson's rule) or 2/dx (Trapezoidal). Now things fall in place and all three algorithms give basically the same result. I still recommend the simple running sum!
02-15-2021 01:32 AM
Thank you very much, this works great! Why would you recommend simple summing? Is that the most memory friendly version? Or is it the most accurate method from a mathematical point of view?
To your note: I do need at least a highpass filter since my sensor creates an offset of round about 0.5 that leads to a drift, when forming the integral to create the velocity signal.