MATLAB: Need help with newton’s theorem (matlab)

MATLABnewtonnewton's method

After running script i put inittial starting point -3, tolerance parameter = 1e-5 , max iteration = 35,
however there is something wrong with the newton script i need to know what it is please thank you. i think the output after plotting fplot(function, [-15,1]) there is something wrong but i am not sure .
any help will be appreicated thanks

Best Answer

It works fine - you're just using a (contrived!) nasty example. Plot your function between -3 and 20 and see where the first Newton step takes you