% Equation 1
Vi(k+1)=w*Vi(k)+c1*r1(Xi,best(k))+c2*r2(Xg,best(k)-Xi(k))
% Equation 2
Xi(k+1)=Xi(k)+Vi(k+1)
% Equation 3
w(k)=wmax-(wmax-wmin)/Niter

답변 (1개)

KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 5월 18일
편집: KALYAN ACHARJYA 2019년 5월 18일

0 개 추천

Last two equations are already in Matlab form, may be just required (.) dot in equation 3 depending on type of variable (if any vector dot operation).
In first equation best(k) menas?

댓글 수: 6

Tauqeer Nadeem
Tauqeer Nadeem 2019년 5월 18일
Please convert these into matlab code.
Walter Roberson
Walter Roberson 2019년 5월 18일
The equations are already in MATLAB form under the assumptions:
  1. That indexing starts at 1
  2. That w, c1, c2, wmin, wmax, Niter are all scalars
  3. That r1 and r2 are each functions that expect a vector for the first argument and a scalar for the second argument, and return scalar values
If k is not a scalar then it is questionable whether correct results would be calculated, but it would not be a MATLAB error.
There are also some circumstances that violate the second and third assumptions in which the code could be valid.
Tauqeer Nadeem
Tauqeer Nadeem 2019년 5월 19일
편집: Tauqeer Nadeem 2019년 5월 19일
Equation 1
Equation 2
Equation 3
someone convert the above equations to matlab code please.
KALYAN ACHARJYA
KALYAN ACHARJYA 2019년 5월 19일
For 2 ans 3 eqns you already did the same. For eq 1 more clarification needed about Xi,best(k)
Tauqeer Nadeem
Tauqeer Nadeem 2019년 5월 19일
But how can I write in matlab ? need help on that
Walter Roberson
Walter Roberson 2019년 5월 19일
You already wrote them in MATLAB form, provided that the three conditions I mentioned hold. If any of those three conditions do not hold, you have to tell us more details.

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

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

2019년 5월 18일

댓글:

2019년 5월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by