Admin Production ni-theme
Current Publication

Moment

LabWindows/CVI

Moment

Advanced Analysis Library Only

AnalysisLibErrType Moment (double inputArray[], ssize_t numberOfElements, int order, double *moment);

Purpose

Calculates the moment about the mean of the input array with the specified order. Moment uses the following formulas to find the moment:

where .

Example Code

/* Generate an array with random numbers and determine its skewness (third-order moment) and its kurtosis (fourth-order moment). */
double x[200], skew, kurtosis;
n, order;
n = 200;
Uniform (n, 17, x);
order = 3;
Moment (x, n, order, &skew);
order = 4;
Moment (x, n, order, &kurtosis);

Parameters

Input
Name Type Description
inputArray double [] Input array used to compute the moment about the mean.
numberOfElements ssize_t Number of elements used to compute the moment about the mean.
order int Moment order.

Note Note  order must be greater than zero. If this value is less than zero, Moment returns an error code and does not calculate the mean.
Default Value: 3.
Output
Name Type Description
moment double Moment about the mean.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 3.1 and later