필터 지우기
필터 지우기

plz explain what does this code do..?

조회 수: 3 (최근 30일)
praveen singathi
praveen singathi 2021년 3월 20일
댓글: praveen singathi 2021년 3월 21일
[V, D] = eig(cov(M));
[z1 s1] = size(D);
for i=1:1:s1
D1(i)=D(i,i);
end
D2=max(D1(i));
for i=1:1:s1
if D1(i)==D2;
a1 = V(:,i)./sum(V(:,i));
end
end
[z2 s2]=size(ca{1});

채택된 답변

KSSV
KSSV 2021년 3월 20일
[V, D] = eig(cov(M)); % Calculates the eigenvalues and eigenvectors of covariance of matrix M
[z1 s1] = size(D); % gets the size of diagonal eigenvalue matrix D
for i=1:1:s1
D1(i)=D(i,i); % this loop saves doagonal elements i.e. eigenvalues in D1/
end
% The above can be achieved with D1 = diag(D)
D2=max(D1(i)); % Assigns D1(s1) to D2, this is wrong..should be D2 = max(D1)
for i=1:1:s1 % loop for each eigenvector/ eigenvalue
if D1(i)==D2; % if D1 is equal to maxof D1
a1 = V(:,i)./sum(V(:,i)); % normalize the eigen vectors
end
end
[z2 s2]=size(ca{1});

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Operating on Diagonal Matrices에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by