Skip to content


Standard deviation

S = std(A)

  • If A is a scalar, S is equal to A.
  • If A is a vector, S is the standard deviation of elements along the longer dimension of A.
  • If A is not a vector, each element of S is the standard deviation of all elements of the corresponding vector of A along the first non-singleton dimension.

S = std(A, flag)

  • Same as S = std(A) above, except that flag determines which of the following formulas will be used:

    standard deviation

S = std(A, flag, k)

  • Same as S = std(A, flag) above, except that elements of S correspond to vectors of A along its k-th dimension.
  • k should be less than or equal to ndims(A).


If a vector contains NaN, the stardard deviation of its elements given by std will be NaN.