Está en la página 1de 2

//CALCULO DE SISTEMAS SIMULTANEOS NO LINEALES

//POR EL METODO DE NEWTON-RAPSON-PUNTO FIJO MODIFICADO


clc
clear
//INGRESE LAS FUNCIONES

..............................

function X=f1(x,y)
X=x^2-10*x+y^2+8;
endfunction
function Y=f2(x,y)
Y=x*y^2+x-10*y+8;
endfunction
//............................................................
x0=input('Ingrese el valor de x0: ');
y0=input('Ingrese el valor de y0: ');
Tol=input('Ingrese la tolerancia del error:

');

//INGRESE LA DERIVADA PARCIAL DE f1 RESPECTO A X


deff('[dpf1x]=dpf1x(x,y)','dpf1x=2*x-10');
//............................................................
//INGRESE LA DERIVADA PARCIAL DE f2 RESPECTO A Y
deff('[dpf2y]=dpf2y(x,y)','dpf2y=2*x*y-10');
//............................................................
x=zeros(1000,1);
y=zeros(1000,1);
x(1)=x0;
y(1)=y0;
i=1;
E=1000;
if dpf1x(x0,y0)<>0 & dpf2y(x0,y0)<>0
while E>Tol
x(i+1)=x(i)-f1(x(i),y(i))/dpf1x(x(i),y(i));
y(i+1)=y(i)-f2(x(i+1),y(i))/dpf2y(x(i+1),y(i));
E=((x(i+1)-x(i))^2+(y(i+1)-y(i))^2)^(1/2);
i=i+1;
end
disp('METODO DE NEWTON-RAPSON-PUNTO FIJO MODIFICADO')
disp('Las raices son: x = '+string(x(i))+', y = '+string(y(i)))
disp('')

else
disp('El metodo no converge')
disp('')
end

También podría gustarte