Standard deviation
S = std(A)
S = std(A,w)
S = std(A,w,dim)
S = std(___,nanflag)
S = std(
returns thestandard deviationof the elements ofA
)A
along the first array dimension whose size does not equal 1.
IfA
is a vector of observations, then the standard deviation is a scalar.
IfA
is a matrix whose columns are random variables and whose rows are observations, thenS
is a row vector containing the standard deviations corresponding to each column.
IfA
is a multidimensional array, thenstd(A)
operates along the first array dimension whose size does not equal 1, treating the elements as vectors. The size of this dimension becomes1
while the sizes of all other dimensions remain the same.
By default, the standard deviation is normalized byN-1
, whereN
is the number of observations.
S = std(
specifies a weighting scheme for any of the previous syntaxes. WhenA
,w
)w = 0
(default),S
is normalized byN-1
. Whenw = 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 ofw
must equal the length of the dimension over whichstd
is operating.