Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NEWTON MATLAB
- h=0.01;
- f= @(x) x.^3+x.^2-20*x;
- df= @(x) (f(x+h)-f(x))/h;
- ddf= @(x) (f(x+2*h)-2*f(x+h)+f(x))/(h^2);
- x = 6;
- a = 0;
- b = 6;
- k = 0;
- while ( df(x) > 0.001 )
- x1=x-(df(x)/ddf(x));
- k=k+1;
- x=x1;
- end
- wynik_newton = x
- n_newton = k
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement