How to impliment a covergence condition?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
How can i impliment a convergence condition in a loop. (the condition is A(k,i)-A(k+1,i)<=0.0001)
and with another condition :( if the condition is true continue, else replace the the last value and repeat).
for emample:
for k=1:t (time loop)
for i=1:10
A(i)=....
end
end (for k)
0 件のコメント
採用された回答
Geoff Hayes
2019 年 5 月 20 日
abdel - perhaps your condtion would be
if abs(A(k,i) - A(k+1,i)) <= 0.0001
% do nothing
else
% replace your value
end
Since we do nothing if the condition is true, we could simplify the above code to
if abs(A(k,i) - A(k+1,i)) > 0.0001
% replace your value
end
2 件のコメント
Geoff Hayes
2019 年 5 月 22 日
maybe this is the wrong condition to use then. Try stepping through the code with the debugger to understand why you might not be getting a result.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!