← Math simulations  ·  EE263, Stanford

Principal directions of a point cloud (PCA via the SVD)

Stack the points as rows of a data matrix X, subtract the mean to get the centered matrix Xc, and take its SVD Xc = UΣV. The columns of V (the right singular vectors) are the principal directions: the first, in red, points along the direction of maximum spread; the second, in green, is orthogonal to it. The singular values σi measure the spread along each direction (variance along axis i is σi2/(N−1)). Drag any point, click empty space to add one, and watch the axes and ellipse update.

SVD of the centered data

points N40
σ1 (spread, 1st axis)0.00
σ2 (spread, 2nd axis)0.00
std along axis 10.00
std along axis 20.00
ratio σ210.00

Presets

Show

1st principal direction (v1)   2nd principal direction (v2)
data points   mean