ClubEnsayos.com - Ensayos de Calidad, Tareas y Monografias
Buscar

Muller Newton-Raphson editor


Enviado por   •  13 de Junio de 2013  •  Trabajos  •  413 Palabras (2 Páginas)  •  505 Visitas

Página 1 de 2

MULLER NEWTON-RAPHSON

EDITOR

function raiz=NewtonRaphson(f,fderiv,x)

error=0.0005;

maxiter=50;

k=0;

fprintf('%5d%15.10f\n',k,x);

while 1

x0=x;

x=x0-f(x0)/fderiv(x0);

k=k+1;

fprintf('%5d%15.10f\n',k,x);

if (abs(x-x0)<=error || k==maxiter)

break

end

end

if k<maxiter

raiz=x;

end

VENTANA DE COMANDOS

3. Resuelva las siguientes ecuaciones aplicando el método de Newton-Raphson:

a) x3-5x2+25x -2=0

>> f=inline('(x^3)-(5.*(x^2))+(25*x)-2')

f =

Inline function:

f(x) = (x^3)-(5.*(x^2))+(25*x)-2

>> fderiv=inline('(3*x^2)-(10*x)+25')

fderiv =

Inline function:

fderiv(x) = (3*x^2)-(10*x)+25

>> NewtonRaphson(f,fderiv,1)

0 1.0000000000

1 -0.0555555556

2 0.0776154641

3 0.0812977895

4 0.0813004578

ans =

0.0813

>>

b) x2-4x+1=0

>> f=inline('x^2-4*x+1')

f =

Inline function:

f(x) = x^2-4*x+1

>> fderiv=inline('2*x-4')

fderiv =

Inline function:

fderiv(x) = 2*x-4

>> NewtonRaphson(f,fderiv,5)

0 5.0000000000

1 4.0000000000

2 3.7500000000

3 3.7321428571

4 3.7320508100

ans

...

Descargar como (para miembros actualizados)  txt (2.4 Kb)  
Leer 1 página más »
Disponible sólo en Clubensayos.com