10-11-2022 08:22 AM
Hello Everyone,
My programm acquire data in single points that I would like to integrate using the real dt and the trapezoidal rule: ((X(i-1) + X(i)) / 2) * dt
Here is what is happening in my programm: I become through a scale the mass in [g]. After derivating in manually with the realt dt (see VI attached) I become the mass flow [g/s]. In order to validate my results I want to integrate the mass flow to get the mass [g]. However, the results of the integration differ significantely from the mesured mass from the scale itself.
I tried to explain the context in the screenshot attached.
Do you have any ideas why am I getting false results ?
best regards
Solved! Go to Solution.
10-11-2022 08:53 AM - edited 10-11-2022 09:33 AM
Hi Ezzow,
1. I'm not sure why you want to "validate" a measured value by derivating it and then re-integrating it right away...
Note that numerical integration is an approximation of the true integral and that you will have a deviation over time due to iterative approximation and rounding errors.
2. Your formula is right but you only compute the surface of the current trapeze.
You must add it up to a shift register to compute the sum of all trapezes to get the global integral.
Test the attached VI:
10-11-2022 09:39 AM
@raphschru wrote:
Hi Ezzow,
1. I'm not sure why you want to "validate" a measured value by derivating it and then re-integrating it right away...
Note that numerical integration is an approximation of the true integral and that you will have a deviation over time due to iterative approximation and rounding errors.
2. Your formula is right but you only compute the surface of the current trapeze.
You must add it up to a shift register to compute the sum of all trapezes to get the global integral.
Test the attached VI:
That made me laugh. You meant "trapezoid" not "trapeze".
10-11-2022 10:05 AM
10-11-2022 10:09 AM
@raphschru wrote:
Damn I was fooled by the french translation "Méthode des trapèzes", I thought trapezoid was the adjective and trapeze the noun.
They're both nouns.
10-12-2022 02:55 AM - edited 10-12-2022 02:55 AM
Hi raphschru,
I apreciate your help, thank you!
The VI is working.
Can you please explain the role of the red marked part? because I didn't get it. I even removed it and it's still working.
best regards
10-12-2022 03:11 AM
@Ezzow wrote:
Can you please explain the role of the red marked part? because I didn't get it. I even removed it and it's still working.
The True sets the starting value to m(g), and then it adds the dy/dx (i assume) If you set a breakpoint after the Select and Retain wire values or Highlight mode it should be obvious.