필터 지우기
필터 지우기

how can I write code to reach my goal as figure below?

조회 수: 1 (최근 30일)
kimy
kimy 2021년 3월 28일
댓글: kimy 2021년 4월 4일
Hi guys,
P is a matrix with dimension i*j; n is an integer. How can I write this formula in matlab? Thanks.
  댓글 수: 2
Adam Danz
Adam Danz 2021년 3월 28일
What part are you having trouble with? How can we help without doing it for you?
kimy
kimy 2021년 3월 29일
Hello Adam, in fact I was trying a loop to give the value for rij, also Ci and Vi However, the code I wrote must be wrong. Could you please give me some suggestions? Thanks.
for i=1:n
for j=1:n
for k=1:n
syms k
R(i,j)=symprod(P(i,k)*P(k,j),k,1,n)^(1/n)
C(i)=(symprod(R(i,k),k,1,n))^(1/n)
V(i)=C(i)/sum(C(k),k,1,n);
end
end
end

댓글을 달려면 로그인하십시오.

답변 (1개)

Adam Danz
Adam Danz 2021년 3월 29일
편집: Adam Danz 2021년 3월 29일
> in fact I was trying a loop to give the value for ri
r is an existing matrix. i and k are just indices. So the value of ri is just r(i,:) and the value of rik is r(i,k).
> also Ci and Vi
What's Vi?
For C, is this what you're looking for?
%n = ?? % scalar
%r = ?? % size nxn
C = nan(1,n);
for i = 1:n
C(i) = nthroot(prod(r(i,1:n)),n);
end
which is the same as
%n = ?? % scalar
%r = ?? % size nxn
C = nthroot(prod(r(1:n,1:n),2),n)
  댓글 수: 3
Adam Danz
Adam Danz 2021년 3월 29일
I don't follow what you're saying and it seems like the question and background information is changing with each comment. I've already reached my allotted volunteer time for the day but I can check back later to see if there is a crystal clear question with all the needed background information.
kimy
kimy 2021년 4월 4일
Sorry, now I solved the problem. But the following comlicated formula seems not so easy to write, could you please give me some suggestions? Thanks.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by