Generate consistent pairwise matrix
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!