PCA eigenvector/eigenvalue help

2 次查看(过去 30 天)
Sim Will
Sim Will 2018-7-25
回答: TED MOSBY 2025-6-12
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.

回答(1 个)

TED MOSBY
TED MOSBY 2025-6-12
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!

类别

Help CenterFile Exchange 中查找有关 Dimensionality Reduction and Feature Extraction 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by