MATLAB: What am I missing in this code I am trying to find roots of a System of Equation

newton raphson method

I am trying to find values of θ and γ for a system of equation where x(1)=θ and x(2)=γ in the code.
The equations are;
I am using the code below but I couldn't find the correct answer. The answer for
The code works, but I get different values for different x intervals, and none of them are correct. (In this case 97.90)
What am I missing?
a(1,1) is the partial differential of with respect to θ
a(1,2) is the partial differential of with respect to γ
a(2,1) is the partial differential of with respect to θ
a(2,2) is the partial differential of with respect to γ
b(1) is
b(2) is
clc;clear;
x=[-1 0.8]; err=[0.01 0.01];
niter1=10;
niter2=50;
err=transpose(abs(err));
for n=1:niter2
x
%Error Equations---------------------------
a(1,1)=-0.2*sin(x(1))+0.2*((1-0.25*sin(x(1))^2)^(-1/2))*(-0.5*sin(x(1))*cos(x(1))); a(1,2)=0;
a(2,1)=0.2*cos(x(1)); a(2,2)=-0.4*cos(x(2));
b(1)=0.2*cos(x(1))+0.4*sqrt(1-0.25*sin(x(1))*sin(x(1)))-0.32;
b(2)=0.2*sin(x(1))-0.4*sin(x(2));
%----------------------------------------------
bb=transpose(b);eps=inv(a)*bb;x=x+transpose(eps);
if n>niter1
if abs(eps)<err
break
else
disp ('Roots are not found')
end
end
end

Best Answer

x=x+transpose(eps)
That should be subtraction rather than addition.