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