Hi. How I can write this formula with Matlab code?

1 view (last 30 days)
  2 Comments
Rik
Rik on 21 Jan 2023
That depends on what psi is, but with a nested loop this is trivial. What did you try?
Aynur Resulzade
Aynur Resulzade on 22 Jan 2023
Edited: Aynur Resulzade on 22 Jan 2023
psi is 2x2 matrix which is depend on n psi(n)=(A11(n) A12(n);A21(n) A22(n))

Sign in to comment.

Answers (1)

Bruno Luong
Bruno Luong on 21 Jan 2023
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
chi = 11.2726
% 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
chi = 11.2726
  4 Comments
Bruno Luong
Bruno Luong on 23 Jan 2023
Edited: Bruno Luong on 23 Jan 2023
@Aynur Resulzade You must kidding me. I'll delete my answer
Aynur Resulzade
Aynur Resulzade on 23 Jan 2023
Edited: Aynur Resulzade on 23 Jan 2023
@Bruno Luong please excecuse me
Sorry I ask second time this question for 2x2 matrix where fi
admin say that you must ask for this in after question and didnt accept answer
that is way I unaccept ((((((
please help me for this problem and don't angry)))

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!