Advertisement
codisinmyvines

aynur

Mar 29th, 2022
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. syms x;
  2. eps = 0.000001;
  3. x0 = input('enter x ');
  4. f = input('enter your function ');
  5. df = diff(f, x);
  6. xn = x0-double(subs(f, x0))/double(subs(df, x0));
  7. while(abs(xn - x0)>eps)
  8. x0 = xn;
  9. xn = x0-double(subs(f, x0))/double(subs(df, x0));
  10. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement