sir I found sum of eigen values of a square matrix. Now I want to find the number of components which cover up to 0.95(95%). My part of prgramme is given in body
Show older comments
sumlamda=0;
for i=1:p
sumlamda = sumlamda+lamda(i);
end
sum=sumlamda
ccomp=0;
s =lamda(p)/sum;
for i =(p-1):1
if s <=0.95
ccomp = ccomp+1;
end
s=(lamda(i)+lamda(i+1))/sum ;
end
ccomp
Answers (1)
Thorsten
on 18 Jan 2016
E = sort(lambda, 'descend');
N = nnz(cumsum(E/sum(E)) <= 0.95)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!