Demo entry 6714225

12

   

Submitted by 12 on Feb 12, 2018 at 15:30
Language: Matlab. Code size: 291 Bytes.

A = [1,1/5,1/3,1;5,1,3,5;3,1/3,1,3;1,1/5,1/3,1];
[x y] = size(A);
B = zeros(x,y);
for i = 1:y
    B(:,i) = A(:,i)/sum(A(:,i));
end  %列向量归一化
C = zeros(x,1);
C
for i = 1:x
    C(i) = sum(B(i,:));
end   %按行求和
C
 w = zeros(x,1)
 for i = 1:x
 w(i) = C(i)/sum(C(:,1));
 end  %归一化
w

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).