nanstd
statistics: s = nanstd (x)
statistics: s = nanstd (x, w)
statistics: s = nanstd (x, w, 'all')
statistics: s = nanstd (x, w, dim)
statistics: s = nanstd (x, w, vecdim)
Compute the standard deviation while ignoring NaN values.
s = nanstd (x) returns the standard deviation of x,
after removing NaN values. If x is a vector, a scalar value is
returned. If x is a matrix, a row vector of column standard deviations
is returned. If x is a multidimensional array, nanstd operates
along the first nonsingleton dimension. If a dimension contains fewer than
two non-NaN values, the standard deviation is returned as 0 for a
single value and as NaN when all values are NaN.
s = nanstd (x, w) specifies the normalization. When
w is 0 (default), the standard deviation is normalized by ,
where is the number of non-NaN observations. When w
is 1, it is normalized by . w may also be a vector of
nonnegative weights whose length matches the operating dimension, in which
case the weighted standard deviation normalized by the sum of the weights is
returned.
s = nanstd (x, w, returns the
standard deviation of all elements of x, after removing 'all')NaN
values. Use an empty value, w = [], to pass the default
normalization.
s = nanstd (x, w, dim) operates along the
dimension dim of x.
s = nanstd (x, w, vecdim) returns the standard
deviation over the dimensions specified in the vector vecdim. A weight
vector is not supported together with 'all' or vecdim. Any
dimension in vecdim greater than ndims (x) is ignored.
See also: std, nanvar, nanmean, nansum
Source Code: nanstd
Find the column standard deviations for a matrix with missing values.
x = magic (3); x([1, 6:9]) = NaN
x =
NaN 1 NaN
3 5 NaN
4 NaN NaN
s = nanstd (x)
s = 0.7071 2.8284 NaN
Find the row standard deviations, normalized by N instead of N-1.
x = magic (3); x([1, 6:9]) = NaN
x =
NaN 1 NaN
3 5 NaN
4 NaN NaN
s = nanstd (x, 1, 2)
s = 0 1 0