MATLAB: Sir, i am not able develop a matlab code to solve four transcendental equations using newton raphson method? i had tried till the creation of jacobian matrix but not able to substitute values in the jacobian matrix please help to solve this problem

newton raphson method

syms x1 x2 x3 x4 epsi;
g1=cos(x1)+cos(x2)+cos(x3)+cos(x4)-0.9424;
g2=cos(5*x1)+cos(5*x2)+cos(5*x3)+cos(5*x4);
g3=cos(7*x1)+cos(7*x2)+cos(7*x3)+cos(7*x4);
g4=cos(11*x1)+cos(11*x2)+cos(11*x3)+cos(11*x4);
g=[g1;g2;g3;g4];
x=[x1; x2; x3; x4];
epsi=10e-5;
j=jacobian(g,x);
for i=1:4
x(i,1)=input('enter the intial values\n')
end
disp(x)
f=subs(j);
j_inv=inv(f);
disp(-g);
k=subs(-g);
p=j_inv*k;
This is my code i am not able to substitute initial values in 'P' matrix. please help me to solve this.

Best Answer

In the given code, the values are not substituted in the jacobian matrix because the initial values are assigned to the variable 'x' but the variables used in the equations are 'x1,x2,x3 and x4'. Please find the code below to substitute the initial values.
x1 = x(1,1);
x2 = x(2,1);
x3 = x(3,1);
x4 = x(4,1);
For more information, refer to this file exchange link