Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate waveform energy using CNiMath::Intergrate function

I use Integrate(Input, Output, 1, 0 ,500) to calculate the area (energy) of the Input. My Area result should be in Output. I ploted Output and what I got was the Input data rising on a negative slope. Was the result in Output cumalative or area of a single point?
0 Kudos
Message 1 of 2
(3,744 Views)
DrObb,

Integrate calculates the discrete numeric integral of the data you provide. In graphical terms, this means that each point in the output data is the sum of the area under the curve up to the corresponding value in the input data.

To calculate the area under a section of the input data, take the difference of the corresponding values in the output data. For instance, if I want to know the area under the curve between the 100th and 200th elements of the input waveform, I would use output[199] - output[99].

The xInit and xFinal are the boundary conditions for your integration (i.e. the approximate value before the first data point and the approximate value after the last data point). I mention this because 500 seems like an unusual boundary val
ue.

Also for the integral value to be meaningful, dt must be correctly specified. dt should equal the distance along the x axis between successive data points. For instance, if your Input data is in Watts with data taken every 0.1 second, then specifying dt as 0.1 will correctly give you an energy value in Joules.

I hope that helps.

TonyH
Measurement Studio
0 Kudos
Message 2 of 2
(3,744 Views)