Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [x, k] = newton(foncjac, tol, N, x0)
- dx = 0;
- x = x0;
- [F0,J0] = foncjac(x0)
- nF0 = norm(F0)
- for k = 1:N
- [F , J] = foncjac(x)
- h = -J \ F;
- x = x + h;
- dx = norm(F) / nF0;
- if dx < tol then
- return [x, k];
- end
- end
- error("Pas de convergence en N itérations.")
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement