MATLAB: How to paste new values into variables in a matrix

iterative methodmatrix with variablesnewton_raphson

I'm using Matlab for a iterative solution of the matrix of nonlinear equations. But I didn't find the command to do it properly and the usual MATLAB codes do not converge and I don't know where the problem is so I have to make codes myself.
Due to the Newton Raphson iterative solver I have obtained the inverse of the Jacobian matrix and the function both with sym variables.
but when I want to replace the sym variables with the previous iteration values this does not happen.
for example consider
syms A B C D
M=[A B;C D];
A=1;
B=2;
C=3;
D=4;
if I run this I expect to have below in the commad
M
M=
[1 2
3 4]
but this doesn't happen why?

Best Answer

because it is a symbolic object and you need to evaluate it so that we have the new values:
syms A B C D
M=[A B;C D];
A=1;
B=2;
C=3;
D=4;
M=eval(M)
but if the matrix is going to be numerical then define it directly:
A=1;
B=2;
C=3;
D=4;
M=[A B;C D];