My objective is to create an applicator for the Matlab Newton-Raphsons method using only a function handle, the initial value and the number of iterations desired. I'm extremely new to Matlab and programming so bare with me for being programming deficient. My question is when making a loop, how can you take the value made from x(adsbygoogle = window.adsbygoogle || []).push({}); _{1}onto x_{2}? For example if I wanted to approximate x^{2}-5 with 6 iterations at the initial value of 100, how would I be able to take the value from x_{5}onto x_{6}?

Here's what I have right now. I know it is absolutely wrong.

function y = mynewton(f,a,n)

syms x

x(0)=a;

df=diff(f(x),n);

for i=1:n

x=x(i-1)-f(x(i-1))/diff(f(x),i-1)

end

y=x

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab Newton-Raphsons method

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads for Matlab Newton Raphsons | Date |
---|---|

Newton's Method In Matlab | Oct 14, 2013 |

Newton's Method Matlab Code | Oct 30, 2012 |

MATLAB Need help with matlab code for newton-raphson (need help really bad) | Jul 1, 2012 |

Newton-Raphson on Matlab | Apr 1, 2012 |

MATLAB Setting up Newton Raphson integral with matlab | Jan 22, 2009 |

**Physics Forums - The Fusion of Science and Community**