PCA eigenvector/eigenvalue help
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.

0 commentaires
Réponses (1)
TED MOSBY
le 12 Juin 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!
0 commentaires
Voir également
Catégories
En savoir plus sur Dimensionality Reduction and Feature Extraction dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!