what is wrong with my newton code? file attached

1 回表示 (過去 30 日間)
Raiven Balderas
Raiven Balderas 2018 年 2 月 19 日
回答済み: Roger Stafford 2018 年 2 月 19 日
What is wrong with my newton code? file is attached.

採用された回答

Roger Stafford
Roger Stafford 2018 年 2 月 19 日
There are three things that need correcting
1. There is no need for the i=1 and i=i+1 commands. The 'for' does all that.
2. You need a test for abs(h) <= tol. If it is true, you should do a 'break' to get out of the for-loop at that point.
3. The value 'maxiter' is set way too low. Set it to a much higher value. It serves only as a guard against a loop that is caught in an endlessly infinite cycling.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by