Generate consistent pairwise matrix
14 ビュー (過去 30 日間)
古いコメントを表示
I have created the following function which creates a pairwise matrix:
function P=pairwise_matrix(S,n)
P=zeros(n,n);
for i=1:n
for j=1:n
if (i==j)
P(i,i)=1; % fill in the diag
elseif j>i % fill in the upper triangular array
P(i,j)=S(ceil(length(S).*rand(1,1)));
end %eof if
end % eof for j
end %eof for i
%fill in the lower triangular array
for k=2:n
for m=1:(k-1)
P(k,m)=1/P(m,k); %otherwise P(k,m)=inv(P(m,k));
end %eof k
end %eof m
endfunction
In another function I calculate the consistency ration, in order to drop the tables that are not consistent. Is there any way of generating consistent matrices in the first place, so that I don't have to drop them later? Could for example the line P(i,j)=S(ceil(length(S).*rand(1,1))); be written different to achieve that?
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!