var
Compute variance values.
Syntax
v = var(x)
v = var(x,scale)
v = var(x,scale,dim)
Inputs
- x
- Data sample.
- scale
- Scale option.
- dim
- Dimension on which to perform the calculation.
Outputs
- v
- Variance.
Example 1
Vector example.
x=[9.3, 10.6, 11.9, 13.3, 15.1, 18.2];
v=var(x)
v = 10.435
Example 2
Matrix example.
x=[9.3, 4.8; 10.6, 6.6; 11.9, 8.0; 13.3, 9.3; 15.1, 10.6; 18.2, 11.9];
v=var(x)
v = [Matrix] 1 x 2
10.435 6.8307
Comments
var (x) = SUM(x(i) - mean(x))^2 / (n-1)
This is the definition for scale = 0.