Solve using Mathlab and Newtons Method Solve the set of equa
Solve using Mathlab and Newtons Method
Solve the set of equations in Math LAB using Newton\'s Method, with initial values x_1 = 1, x_2 = 2. Include the code and results. f_1(x_1, x-2) = sin (x_1 x_2 + 1) + 2x_1 = 0 f_2 (x_1, x_2) = e^x_1 + x_2 + 5x_2 = 0Solution
clc;
clear all;
format short e
x1= 1; x2=2;
a=0.5
%for i=1:100
err=0.001;
while(err>1e-8)
f1=sin(x1*x2+1)+2*x1;
f2=(exp(x1+x2)+5*x2);
f11=cos(x1*x2+1)*x2+2;
f12=cos(x1*x2+1)*x1;
f21=exp(x1+x2);
f22=exp(x1+x2)+5;
J=[f11 f12 ; f21 f22];
J1=inv(J);
%J1*[f1; f2]
Z=[x1;x2]-J1*[f1; f2];
%err(i)=sum(abs((abs(Z)-[x(i);y(i)])))/sum(abs(Z))
err=abs(J1*[f1; f2]);
x1=Z(1)
x2=Z(2)
end
x1 =
-4.3373e-001
x2 =
-1.1548e-001
