Está en la página 1de 2

%Metodo de Newton Raphson

fprintf('Metodo de Newton Raphson\n')


fprintf('\n')
fprintf('f=x^3+3*x^2+4*x+12\n')
fprintf('g=3*x^2+6*x+4\n')
fprintf('\n')
x0=1+1i; Eps=0.001;
fprintf(' i(iterac) x dist(xi+1 - xi) f\n')
for I=1:10
f=x0^3+3*x0^2+4*x0+12;
d=3*x0^2+6*x0+4;
x=x0-f/d;
dist=abs(x-x0);
if eps > dist
break
end
fprintf('%10.0f %10.5f %10.5f i %10.5f %10.5f\
n',I,real(x),imag(x),dist,f)
x0=x;
end

SOLUCION:
Metodo de Newton Raphson
f=x^3+3*x^2+4*x+12
g=3*x^2+6*x+4
i(iterac) x dist(xi+1 - xi) f
1 -0.16393 1.19672 i 1.18044 14.00000
2 -0.23255 2.51446 i 1.31952 7.82839
3 -0.10784 2.05174 i 0.47923 -3.33724
4 -0.00292 1.99398 i 0.11977 0.33526
5 0.00001 2.00002 i 0.00671 0.09524
6 0.00000 2.00000 i 0.00002 -0.00029
7 0.00000 2.00000 i 0.00000 -0.00000

También podría gustarte