フィルターのクリア

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});
  1 件のコメント
praveen singathi
praveen singathi 2021 年 3 月 21 日
thank you very much

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by