Get a sorted matrix of eigen vectors

조회 수: 1 (최근 30일)
Tushar Aggarwal
Tushar Aggarwal 2015년 11월 29일
답변: Tushar Aggarwal 2015년 11월 29일
I have to write a function that takes in X (N*D data matrix) and return eigenvecs a D*D matrix, normalized eigenvectors (with length=1) sorted based on its eigenvalue magnitude (with d-th column corresponds to eigenvector with the d-th biggest eigenvalue).
How can I use eig to solve this problem. eig take sonly square matrix but X here id N*D

답변 (1개)

Tushar Aggarwal
Tushar Aggarwal 2015년 11월 29일
Normalize X to have 0 mean
X=X-mean(X(:));
calculate covariance
covx = cov(X);
and then eignvectors and eigenvalue
[a,b] = eig(covx);

카테고리

Help CenterFile Exchange에서 Linear Algebra에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by