nanvar
Compute variances, ignoring NaN values.
Syntax
v = nanvar(x)
v = nanvar(x,scale)
v = nanvar(x,scale,dim)
Inputs
- x
- Data sample.
- scale
- Scale option.
- dim
- Dimension on which to perform the calculation.
Outputs
- v
- Variance.
Examples
Vector example:
x = [9.3, 10.6, nan, 11.9, 13.3, nan, 15.1, 18.2];
v = nanvar(x)
v = 10.4346667
Matrix example:
x = [9.3, 4.8; 10.6, 6.6; nan, nan; 11.9, 8.0; 13.3, 9.3; 15.1, 10.6; 18.2, 11.9];
v = nanvar(x)
v = [Matrix] 1 x 2
10.43467 6.83067