Problem with while loop
조회 수: 1 (최근 30일)
이전 댓글 표시
I wrote 3 functions and i wanted to link them in main function. In the main function i wrote a while loop . i am facing problem with this while loop. . The loop is running with initial values, i.e., it is not updating the values of rcapa, capaPAMin, and Bineq. The main function runs as follows
How to correct this problem.
global Bineq1; capaPAMin = inf; Bineq2 = capaPAMin; Bineq = vertcat(Bineq1,Bineq2); iter = 1; while(iter <=15) DA2 = @(Bineq,capaPAMin) somefunction(c1,c2,c3,c4,c8,capaPAMin,Aineq,Bineq,Aeq,Beq,lb2,ub2); [yd2,DAC2] = DA2(Bineq,capaPAMin); td2 = yd2(1345:1728); -- -- -- rcapa -- -- PA2 = @(rcapa) somotherfunction(c5,c6,c7,Aineq,Bineq,Aeq,rcapa,lb1,ub1); [yp2,PAC2] = PA2(rcapa); b = yp2(385:576); -- -- capaPA -- -- if capaPAMin > capaPA capaPAMin = capaPA; end Bineq2 = capaPAMin; Bineq = vertcat(Bineq1,Bineq2); iter = iter + 1; end
댓글 수: 2
KL
2017년 10월 19일
Please format your code. To do that, select the code in your question, click the {} Code button. That way, it is much easier to read.
채택된 답변
추가 답변 (0개)
참고 항목
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!