Graphics Reference
In-Depth Information
n
n
1
n
1
n
2
u ) 2
x i
u 2 .
σ
=
( x i
=
i
=
1
i
=
1
The square root of the variance is known as the standard deviation . For values spread
along a single axis, the variance is easily computed as the average of the squared
deviation of the values from the mean:
// Compute variance of a set of 1D values
float Variance(float x[], int n)
{
float u = 0.0f;
for(inti=0;i<n;i++)
u += x[i];
u/=n;
float s2 = 0.0f;
for(inti=0;i<n;i++)
s2 += (x[i] - u) * (x[i] - u);
return s2 / n;
}
Usually there is no obvious direct interpretation of variance and standard devia-
tion. They are, however, important as comparative measures. For two variables, the
covariance measures their tendency to vary together. It is computed as the average of
products of deviation of the variable values from their means. For multiple variables,
the covariance of the data is conventionally computed and expressed as a matrix, the
covariance matrix (also referred to as the variance-covariance or dispersion matrix).
(b)
(a)
Figure 4.8 The same point cloud projected onto two different axes. In (a) the spread on the
axis is small. In (b) the spread is much larger. A bounding sphere can be determined from
the axis for which the projected point set has the maximum spread.
Search WWH ::




Custom Search