MATLAB: System of nonliner equations with symbolic variables

fsolvesymbolic

Hi there,
I would like to ask you how to solve a system of nonlinear equations while using symbolic variables.
I have two equations that I need to solve:
eqT = 10*lamT^13*lamZ^13 - 10/lamT^13 - 10*lamT^2*lamZ
eqZ = 10*lamT^13*lamZ^13 - 10/lamZ^13 - 5*lamT^2*lamZ
where lamT and lamZ are symbolic.
I was trying to search for it and most times I have found to use matlabFunction and fsolve. But it doesn't work for me. Probably I understand it wrong or maybe I am doing another mistake.
fun = matlabFunction(eqT, eqZ)
eqsol = fsolve(fun,[1 1])
Can you please help me and explain me what I am doing wrong.
Thank you very much
P.S.: it is not possible not to use symbolic variables. They are used for some derivations before. Also it is not possible to rewrite the equations manually because they are to be solved many times in for cycle with different constants.

Best Answer

The code needs a few adjustments:
syms lamT lamZ
eqT = 10*lamT^13*lamZ^13 - 10/lamT^13 - 10*lamT^2*lamZ;
eqZ = 10*lamT^13*lamZ^13 - 10/lamZ^13 - 5*lamT^2*lamZ;
fun = matlabFunction([eqT; eqZ], 'Vars',{[lamT lamZ]})
eqsol = fsolve(fun,[1 1])
producing:
Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the value of the function tolerance, and
the problem appears regular as measured by the gradient.
<stopping criteria details>
eqsol =
1.046382084316825 0.992821241450066
The approach concatenates ‘eqT’ and ‘eqZ’ to creatd a (2x1) matrix, and combine ‘lamT’ and ’lamZ’ into the ‘in1’ parameter vector that fsolve requires. Then fsolve does the rest.
.