Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

var - Variance

Syntax

V = var(X)
V = var(X,1)
V = var(X,w)
V = var(X,w,dim)

Description

V = var(X) returns the variance of X for vectors. For matrices, var(X)is a row vector containing the variance of each column of X. For N-dimensional arrays, var operates along the first nonsingleton dimension of X. The result V is an unbiased estimator of the variance of the population from which X is drawn, as long as X consists of independent, identically distributed samples.

var normalizes V by N-1 if N>1, where N is the sample size. This is an unbiased estimator of the variance of the population from which X is drawn, as long as X consists of independent, identically distributed samples. For N=1, V is normalized by N.

V = var(X,1) normalizes by N and produces the second moment of the sample about its mean.var(X,0) is equivalent to var(X).

V = var(X,w) computes the variance using the weight vector w. The length of w must equal the length of the dimension over which var operates, and its elements must be nonnegative. The elements of w must be positive. var normalizes w to sum of 1.

V = var(X,w,dim) takes the variance along the dimension dim of X. Pass in 0 for w to use the default normalization by N-1, or 1 to use N.

The variance is the square of the standard deviation (STD).

See Also

corrcoef, cov, mean, median, std

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS