What is wrong in this code??
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
theintern
am 17 Okt. 2017
Kommentiert: theintern
am 18 Okt. 2017
Could you please help me to solve the problem? Loop cannot stop.
Attached you can find the file. The function is digdata and the other is code. Thank you.
0 Kommentare
Akzeptierte Antwort
Jan
am 17 Okt. 2017
In this loop:
while abs(res1)>0.01
As = vq.*(Us(j).^2)./(16.*(pi.^2).*msksi.*fs1(j));
res1 = As1(i)-As;
end
you calculate the same value in each iteration. As will never change its value. Therefore this must be an infinite loop.
Due to the missing comments, the purpose of this loop cannot be guessed. Therefore a reliable suggestion of improvement cannot be given.
Weitere Antworten (1)
theintern
am 18 Okt. 2017
2 Kommentare
Jan
am 18 Okt. 2017
Bearbeitet: Jan
am 18 Okt. 2017
Please post details belonging to the question by editing the question, not as answers. Thanks.
"There is a dimensional problem that I couldn't solve." Then please post any details. Do you get an error message? Then post it completely.
The clear all in your code destroys the current work, if somebody tries to your code to help you. It is much smarter to store the code in a function instead of clearing everything brutally.
Your code will be much easier to read, if you select it an press Ctrl-I in the editor.
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!