# std

Standard deviation

## Syntax

## Description

returns
the standard deviation of the elements of `S`

= std(`A`

)`A`

along the first array
dimension whose size does not equal 1. By default, the standard deviation is
normalized by `N-1`

, where `N`

is the number of
observations.

If

`A`

is a vector of observations, then`S`

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 deviation 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`S`

in this dimension becomes`1`

, while the sizes of all other dimensions are the same as in`A`

.If

`A`

is a scalar, then`S`

is`0`

.If

`A`

is a`0`

-by-`0`

empty array, then`S`

is`NaN`

.If

`A`

is a table or timetable, then`std(A)`

returns a one-row table containing the standard deviation of each variable.*(since R2023a)*

specifies a weighting scheme. When `S`

= std(`A`

,`w`

)`w = 0`

(default), the standard
deviation is normalized by `N-1`

, where `N`

is the
number of observations. When `w = 1`

, the standard deviation is
normalized by the number of observations. `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.

returns the standard deviation over the dimensions specified in the vector
`S`

= std(`A`

,`w`

,`vecdim`

)`vecdim`

when `w`

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

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

returns
the standard deviation over all elements in `A`

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

specifies whether to include or omit missing values in `S`

= std(___,`missingflag`

)`A`

for any
of the previous syntaxes. For example, `std(A,"omitmissing")`

ignores all missing values when computing the standard deviation. By default,
`std`

includes missing values.

`[`

also returns the mean of the elements of `S`

,`M`

] = std(___)`A`

used to calculate the
standard deviation. If `S`

is the weighted
standard deviation, then `M`

is the weighted
mean.

## Examples

## Input Arguments

## Output Arguments

## More About

## Extended Capabilities

## Version History

**Introduced before R2006a**