PCA eigenvector/eigenvalue help

2 visualizaciones (últimos 30 días)
Sim Will
Sim Will el 25 de Jul. de 2018
Respondida: TED MOSBY el 12 de Jun. de 2025
Hey, I would like to calculate PC1 PC2 and PC3 of this 3D loop (show attached picture). It's 3angles plotted together /time. Someone already helped me finding a few things but Ultimatly I would like to know the value of the 3 first eigenvectors and there direction. Thx for any help.

Respuestas (1)

TED MOSBY
TED MOSBY el 12 de Jun. de 2025
Hi,
To compute the first three principal components you need the numeric time-series of your three joint angles (thigh, shank, foot). Assuming you have 3 vectors such that:
thighAngle : N-by-1
shankAngle : N-by-1
footAngle : N-by-1
Once you have those three columns, PCA is straightforward:
X = [thighAngle(:) shankAngle(:) footAngle(:)];
Xm = X - mean(X,1);
% 2. Run PCA (Statistics & ML Toolbox)
[coeff, score, latent, ~, explained, mu] = pca(X); % ‘coeff’ are the eigenvectors
PC1_dir = coeff(:,1); % unit-length direction of the first PC
PC2_dir = coeff(:,2);
PC3_dir = coeff(:,3);
PC1_eig = latent(1); % eigenvalue (variance captured by PC1)
PC2_eig = latent(2);
PC3_eig = latent(3);
PC1_score = score(:,1); % time-series of the loop projected onto PC1
Here is the documentation of PCA:
Hope this helps!

Categorías

Más información sobre Dimensionality Reduction and Feature Extraction en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by