# Documentation

### This is machine translation

Translated by
Mouse over text to see original. Click the button below to return to the English verison of the page.

# moment

Central moments

## Syntax

`m = moment(X,order)moment(X,order,dim)`

## Description

`m = moment(X,order)` returns the central sample moment of `X` specified by the positive integer `order`. For vectors, `moment(x,order)` returns the central moment of the specified order for the elements of `x`. For matrices, `moment(X,order)` returns central moment of the specified order for each column. For N-dimensional arrays, `moment` operates along the first nonsingleton dimension of `X`.

`moment(X,order,dim)` takes the moment along dimension `dim` of `X`.

## Examples

```X = randn([6 5]) X = 1.1650 0.0591 1.2460 -1.2704 -0.0562 0.6268 1.7971 -0.6390 0.9846 0.5135 0.0751 0.2641 0.5774 -0.0449 0.3967 0.3516 0.8717 -0.3600 -0.7989 0.7562 -0.6965 -1.4462 -0.1356 -0.7652 0.4005 1.6961 -0.7012 -1.3493 0.8617 -1.3414 m = moment(X,3) m = -0.0282 0.0571 0.1253 0.1460 -0.4486```

collapse all

### Tips

Note that the central first moment is zero, and the second central moment is the variance computed using a divisor of n rather than n – 1, where n is the length of the vector `x` or the number of rows in the matrix `X`.

The central moment of order k of a distribution is defined as

`${m}_{k}=E{\left(x-\mu \right)}^{k}$`

where E(x) is the expected value of x.