FUNCTION REFERENCE

var

Variance.

Variance.

Syntax

var(A)

Syntax

var(A, w, dim)

Syntax

var(A, 0, 'all', 'omitnan')

w is 0 (divide by n-1, default) or 1 (divide by n). dim is a positive integer or 'all'. 'omitnan' or 'includenan' may follow.

Example

var([1 2 3 4])   % 1.6667

Differences from MATLAB: Real and complex double arrays, one output. Vector weights and vecdim are not supported. Complex input gives a real result from abs(x - mean).^2.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.