Index error when using function

I'm getting this error:
Array indices must be positive integers or
logical values.
Error in newton (line 16)
x = x - (f(x))/dx(x);

回答 (1 件)

James Tursa
James Tursa 2019 年 5 月 7 日
編集済み: James Tursa 2019 年 5 月 7 日

0 投票

We need to see more of your code to be sure, but you likely have a variable named either f or dx that is shadowing a function of the same name. The solution is to pick a different name for this variable.

カテゴリ

ヘルプ センター および File ExchangeMatrix Indexing についてさらに検索

質問済み:

2019 年 5 月 7 日

編集済み:

2019 年 5 月 7 日

Community Treasure Hunt

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

Start Hunting!

Translated by