Write matlab code for the following algorithm
이전 댓글 표시
I have this algorithm

I write this code for my example
A = [10 -10; 1 0; -1 0; 0 -1 ; 0 1; 11 -10; -1 -1];
C = cov(A).^(-1/2).*A;
M = size(A,1);
omega = C*C';
x0=[];x1=[];x2=[];PS=[];
for i0=1:M
for i1=1:M
for i2=1:M
j = 0;
if isequal(i2,i1)
x2(j) = abs(omega(i1,i0)+omega(i2,i0));
j = j+1;
end
end
x1(j) = min(median(x2,'all')); % lower median
end
x0(j) = 1.1 .* min(median(x1,'all')); % lower median
end
for i3=1:M
PS(i3) = max(omega(i3)/x0);
end
but the above-mentioned code has many problems. I do not know how to fix it.
the result should be
PS = [16.77;0.839;0.839;0.839;0.839;17.609;1.677];
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 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!