To solve the nonlinear system of equations

$$\begin{array}{l}\mathrm{exp}(-\mathrm{exp}(-({x}_{1}+{x}_{2})))={x}_{2}(1+{x}_{1}^{2})\\ {x}_{1}\mathrm{cos}({x}_{2})+{x}_{2}\mathrm{sin}({x}_{1})=\frac{1}{2}\end{array}$$

using the problem-based approach, first define `x`

as a two-element optimization variable.

Create the left side of the first equation. Because this side is not a polynomial or rational function, process this expression into an optimization expression by using `fcn2optimexpr`

.

Create the first equation.

Similarly, create the left side of the second equation by using `fcn2optimexpr`

.

Create the second equation.

Create an equation problem, and place the equations in the problem.

Review the problem.

EquationProblem :
Solve for:
x
eq1:
arg_LHS == (x(2) .* (1 + x(1).^2))
where:
anonymousFunction1 = @(x)exp(-exp(-(x(1)+x(2))));
arg_LHS = anonymousFunction1(x);
eq2:
arg_LHS == 0.5
where:
anonymousFunction2 = @(x)x(1)*cos(x(2))+x(2)*sin(x(1));
arg_LHS = anonymousFunction2(x);

Solve the problem starting from the point `[0,0]`

. For the problem-based approach, specify the initial point as a structure, with the variable names as the fields of the structure. For this problem, there is only one variable, `x`

.

Solving problem using fsolve.
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.

sol = *struct with fields:*
x: [2x1 double]

fval = *struct with fields:*
eq1: -2.4069e-07
eq2: -3.8253e-08

exitflag =
EquationSolved

View the solution point.