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 Exchange 中查找有关 Test Model Components 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by