Hi. How I can write this formula with Matlab code?
조회 수: 1 (최근 30일)
이전 댓글 표시

댓글 수: 2
Rik
2023년 1월 21일
That depends on what psi is, but with a nested loop this is trivial. What did you try?
답변 (1개)
Bruno Luong
2023년 1월 21일
n=10;
psi=rand(1,n-2);
chi = 0;
for k=1:n-2
i = nchoosek(1:n-2,k);
j = 1:k;
l = k+1-j;
il = i(:,l);
chi = chi+sum(prod(psi(il),2));
end
chi
% Or remove some of the unecessary indexing with j and l
chi = 0;
for k=1:n-2
chi = chi+sum(prod(psi(nchoosek(1:n-2,k)),2));
end
chi
댓글 수: 4
Bruno Luong
2023년 1월 23일
편집: Bruno Luong
2023년 1월 23일
@Aynur Resulzade You must kidding me. I'll delete my answer
참고 항목
카테고리
Help Center 및 File Exchange에서 Clusters and Clouds에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!