Standard deviation

Syntax: | `s = STDEV(x)` `s = STDEV(w,x)`

The `STDEV` function only accepts one or two vector arguments. If only one vector is entered, the function returns the standard deviation of that vector's data. If two vectors are entered, the first vector holds the weights and the second vector holds the data. The result is always a scalar value.

Suppose that x is a vector with N elements.

A weight vector, w, may be entered as the first argument. The length of w is assumed to also be N. If no weights are entered, defaults to `1`, for . Define the total weight:

The mean value, , is defined by

The variance, , is defined by

The standard deviation, , is defined by

Examples

Suppose `X = [1;2;3;4;5;6;7;8;9;10]`, then `A = STDEV(X)` returns scalar `A` with the value `3.02765`.

Suppose `W = [1;1;1;5;5;5;5;1;1;1]`, then `A = STDEV(W,X)` returns scalar `A` with the value `2.09293`.