How to use newton.m to find solutions to equations.

3 views (last 30 days)
Hi. I've got a question that asks me to use the 'newton.m' function which I've downloaded and opened onto matlab, to solve 'x + 1 = atan(x)'. I am not sure how to use the newton.m program, and have not been able to find the method of using it online.
This is what I've got so far but i keep getting errors and am not sure where to go from here:
>> syms x
x_estimate = newton(x + 1 - atan(x), 1 - 1/(x^2 + 1), -1, 10^(-7))
Iteration xo x1 f(x)
========= =======================================================
Array indices must be positive integers or logical values.
Error in sym/subsref (line 890)
R_tilde = builtin('subsref',L_tilde,Idx);
Error in newton (line 14)
while ((abs(f(x0)) >= epsilon) && (Iter<30))
I'd really appreciate if anyone can help me with this.
Thanks a lot

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!