Version:

Last Modified: January 9, 2017

Computes the variance of the input elements.

y = var(x)

y = var(x, w)

y = var(x, w, d)

Scalar or array of any dimension.

Weight. w is a scalar or a vector. If w is a scalar, w is an indicator, which can only be 0 or 1. If w is a vector, w is the weight.

Specifies the dimension of x across which to compute the variance. d can be in a range of 1 to the maximum supported array dimension (32). If you do not specify d, the function works with the first dimension whose size is not equal to 1.

Variance of x. y is a scalar or an array.

w can be in one of the following states:

- If x is a vector, w is a vector of the same size as x. If x is an array, w is a vector of the same size as the dimension of x across which to compute the variance. All elements in w must be greater than 0. MathScript normalizes w so the sum of all the elements in w is equal to 1.
- w is a vector with only one element, 1. The input array has no weight. MathScript normalizes the output by the length of the input array.
- w is a vector with only one element, 0, or w is an empty vector. The input array has no weight. MathScript normalizes the output by the length of the input array minus one.

X = [1, 2, 3, 4, 5, 6; 2, 4, 6, 8, 10, 12] Y = var(X)

**Where This Node Can Run: **

Desktop OS: Windows

FPGA: Not supported