| 2.1.23.1.1 ocmath_calc_peak_moments
 DescriptionCalculate moments for the peak data use trapezoidal integration method
 Syntaxint 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 momentOCMATH_PEAK_CENTRAL_MOMENT			calculate central momentOCMATH_PEAK_ZERO_POINT_MOMENT		calculate zero point moment nMomentOrder[input] the order of the moment
 ReturnReturn OE_NOERROR if succeed, otherwise, non-zero error code is returned.
 ExamplesEX1
 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);
}RemarkSee AlsoHeader to Includeorigin.h
 Reference |