Updating an Iteration with new value

조회 수: 4 (최근 30일)
Kamilu Sanusi
Kamilu Sanusi 2023년 1월 28일
댓글: Kamilu Sanusi 2023년 1월 29일
Hello everone,
I am trying to solve an equation of which i need to be using the new values of V and delta as an update in equations (1). Please which one of equations (2 & 3) is the correct updating code for new values;
% P(i) = sum(j=1->n) |Vi||Vj|(Gij * cos(delta_i - delta_j) + Bij * sin(delta_i - delta_j) equation (1) % The formula for calculating the P
Implementation of P(2) for example:
P(2) = P(2) + V(2)*V(1)*(G(2,1)*cos(delta(2)-delta(1)) + B(2,1)*sin(delta(2)-delta(1))) + V(2)*V(2)*(G(2,2)*cos(delta(2)-delta(2)) + B(2,2)*sin(delta(2)-delta(2))) + V(2)*V(3)*(G(2,3)*cos(delta(2)-delta(3)) + B(2,3)*sin(delta(2)-delta(3))) + V(2)*V(4)*(G(2,4)*cos(delta(2)-delta(4)) + B(2,4)*sin(delta(2)-delta(4))) + V(2)*V(5)*(G(2,5)*cos(delta(2)-delta(5)) + B(2,5)*sin(delta(2)-delta(5)))
THANK YOU
Vprev = V;
deltaprev = delta
........................................................................................................
for i = 1:5
for j = 1 : 5
P(i) = P(i) + V(i)*V(j)*(G(i,j)*cos(delta(i)-delta(j)) + B(i,j)*sin(delta(i)-delta(j))) equation (2)
end
end
OR
for i = 1:5
for j = 1 : 5
P(i) = V(i)*V(j)*(G(i,j)*cos(delta(i)-delta(j)) + B(i,j)*sin(delta(i)-delta(j))) equation (3)
end
end
  댓글 수: 10
Kamilu Sanusi
Kamilu Sanusi 2023년 1월 29일
delta_ij = delta_i - delta_j same with delta(i,j) = delta(i) - delta(j)
Kamilu Sanusi
Kamilu Sanusi 2023년 1월 29일
@Image Analyst, Please any input?

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Particle & Nuclear Physics에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by