Save old values in an iteration (while loop)

26 ビュー (過去 30 日間)
Mehdi
Mehdi 2015 年 9 月 7 日
回答済み: Walter Roberson 2015 年 9 月 8 日
Hi,
In Newton_Raphson iteration, I need to compare old and new values of X so that it stops when their difference is very small. How can I save old values? Thank you very much in advance.

採用された回答

Walter Roberson
Walter Roberson 2015 年 9 月 8 日
prev_value = inf;
while true
new_value = .... some calculation
if abs(prev_value - new_value) < YourTolerance
break;
end
prev_value = new_value;
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeNewton-Raphson Method についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by