ocmath_calc_peak_moments
Description
Calculate moments for the peak data use trapezoidal integration method
Syntax
int ocmath_calc_peak_moments( UINT nSize, const double * pX, const double * pY, double * pMoment, int nMomentType = OCMATH_PEAK_CENTRAL_MOMENT, uint nMomentOrder = 2 )
Parameters
- nSize
- [input] size of the peak data
- pX
- [input] pointer to x coordinates of the data
- pY
- [input] pointer to y coordinates of the data
- pMoment
- [output] the moment value wanted
- nMomentType
- [input] the type of the moment
- OCMATH_PEAK_CENTRAL_MOMENT calculate central moment
- OCMATH_PEAK_ZERO_POINT_MOMENT calculate zero point moment
- nMomentOrder
- [input] the order of the moment
Return
Return OE_NOERROR if succeed, otherwise, non-zero error code is returned.
Examples
EX1
void ocmath_calc_peak_moments_ex1()
{
// the full peak data
vector vx = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
vector vy = {8.15988E-4,
0.01832,
0.16901,
0.64118,
1,
0.64118,
0.16901,
0.01832,
8.15988E-4,
1.49453E-5}
double dMoment;
ocmath_calc_peak_moments(vx.GetSize(), vx, vy, &dMoment, OCMATH_PEAK_ZERO_POINT_MOMENT, 1);
printf ("%lf\n", dMoment);
}
Remark
See Also
header to Include
origin.h
Reference
|