matlab get stop executing while loop for no reason

Hello everyone:
I am facing a strange problem with Matlab. I have a while loop that should execute optimization function "fminmax". The problem is that suddenly the program stop working it is like it froze. It does not finish the execution, it does not end it also, nothing..as shown in figure bellow.
Does anyone here have an idea why this happen????
Thank you in advance.

9 件のコメント

Weird Rando
Weird Rando 2016 年 5 月 4 日
編集済み: Weird Rando 2016 年 5 月 4 日
You're just stuck in an infinite loop. Chance are that the variable may not be meeting the condition you set for the while loop.
meriame
meriame 2016 年 5 月 4 日
no the loop is not infinite we are sure that the function will converge and even if it does not converge the program should not just stop like that without moving .. you see the j bellow counts the iterations done by the loop it is fix
Jan
Jan 2016 年 5 月 4 日
The screenshot does not contain any useful information. Please restart Matlab and/or the computer to check, if the problem is reproducible. If so, post the relevant part of the code. Perhaps you only requested a rand(1e6) and the computer stalls while trying to reserve a 10 TByte array.
meriame
meriame 2016 年 5 月 4 日
編集済み: meriame 2016 年 5 月 4 日
Bellow you will find the part where Matlab get stuck. It is an implementation of Dinkelbach algorithm. For simulation, I am using a matlab version installed on the server.
while maxfval >= epsilon
[x,~,maxfval,exitflag] = fminimax(@(x) FP_function(sigma2, nbr_R, x, h, H, Sc, lambda1), x, [], [], [], [], lb, ub,... @(x) nonlconstr(sigma2, nbr_R, x, h, H, Sc, rates))
[~, sum_rate, sum_Power] = SINR_Rate(sigma2, nbr_R, x, h, H, Sc)
lambda1 = min(sum_rate./ sum_Power)
maxfval=abs(maxfval)
j=j+1 % just to calculate iterations
end
CS Researcher
CS Researcher 2016 年 5 月 4 日
Print your maxfval and see if it ever gets smaller than the epsilon. If not, increase the epsilon.
meriame
meriame 2016 年 5 月 4 日
the behavior is not as an infinite loop. The code just stop no condition checking, no error msg just stop in j=j+1
CS Researcher
CS Researcher 2016 年 5 月 4 日
What is the error message? Have you initialized j somewhere in the code? Also, there should be a ';' between maxfval=abs(maxfval) and j=j+1
meriame
meriame 2016 年 5 月 4 日
yes i initialized before while loop and i took out ; to see the value in the commend line and again there is not error msg, matlab does not stop executing the code at all and does not continuous as well. It just stop
CS Researcher
CS Researcher 2016 年 5 月 4 日
Well then it seems that maxfval becomes smaller than epsilon in the first run. Try changing epsilon. It would be easier for me to understand if you can share the entire code.

サインインしてコメントする。

回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Introduction to Installation and Licensing についてさらに検索

タグ

質問済み:

2016 年 5 月 4 日

コメント済み:

2016 年 5 月 4 日

Community Treasure Hunt

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

Start Hunting!

Translated by