How to code "while" loop for the following problem?
이전 댓글 표시
hello friends. I want to write "while" loop for the follwing problem but it don't give the answer which i want. ii starts from 0. The system which i want is like that.
3.749893 , 3.749893 + ii(0) = ii1
5.217726 , ii1 + 5.217726 = ii2
0.412081 , ii2 + 0.412081 = ii3
0.113385 , ii3 + 0.113385 = ii4
1.27062 , ii4 + 1.27062 = ii5
2.740936 , ii5 + 2.740936 = ii6
2.208374 , ii6 + 2.208374= ii7
so on..
I cant code this proble in while loop.
Thanks in advance.
ii = 0;
for sun = 1:1:p ;
if load(sun,1) < pv (sun,1);
h = pv(sun,1)-load (sun,1);
n(sun,1) = double (h); % (PV'den artan Enerji)
deger = sum (n); % (Artan Enerjinin toplam degeri)
Q = find (n > 0);
answer = n(Q);
WW= answer / 4;
k = 1;
while ii < deger ;
g2 = ii + WW;
ii = g2;
end
end
댓글 수: 4
infinity
2019년 7월 14일
Hello,
How about if you put "ii = 0;" inside the for loop? Since when "sun" increases, ii is not reset to 0. Is it what you realy want to do?
Mohammad Sulaiman Stanekzai
2019년 7월 14일
KALYAN ACHARJYA
2019년 7월 14일
편집: KALYAN ACHARJYA
2019년 7월 14일
Sorry, still the question is not clear for me.
Mohammad Sulaiman Stanekzai
2019년 7월 14일
편집: Mohammad Sulaiman Stanekzai
2019년 7월 14일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
