Standard deviation

`S = std(A)`

`S = std(A,w)`

`S = std(A,w,'all')`

`S = std(A,w,dim)`

`S = std(A,w,vecdim)`

`S = std(___,nanflag)`

`S = std(`

returns
the standard deviation of
the elements of `A`

)`A`

along the first array dimension
whose size does not equal 1.

If

`A`

is a vector of observations, then the standard deviation is a scalar.If

`A`

is a matrix whose columns are random variables and whose rows are observations, then`S`

is a row vector containing the standard deviations corresponding to each column.If

`A`

is a multidimensional array, then`std(A)`

operates along the first array dimension whose size does not equal 1, treating the elements as vectors. The size of this dimension becomes`1`

while the sizes of all other dimensions remain the same.By default, the standard deviation is normalized by

`N-1`

, where`N`

is the number of observations.

`S = std(`

specifies
a weighting scheme for any of the previous syntaxes. When `A`

,`w`

)```
w
= 0
```

(default), `S`

is normalized by `N-1`

.
When `w = 1`

, `S`

is normalized
by the number of observations, `N`

. `w`

also
can be a weight vector containing nonnegative elements. In this case,
the length of `w`

must equal the length of the dimension
over which `std`

is operating.

`S = std(`

computes the standard deviation over the dimensions specified in the vector
`A`

,`w`

,`vecdim`

)`vecdim`

when `w`

is 0 or 1. For example, if
`A`

is a matrix, then `std(A,0,[1 2])`

computes the standard deviation over all elements in `A`

, since
every element of a matrix is contained in the array slice defined by dimensions 1
and 2.