Solving Non Linear System of Equations with MATLAB

I encountered a non-linear system of equations that has to be solved. The system of equations can be written as: $$Ax + \exp(x) = b$$ with $b$ a known $N\times 1$ matrix, $A$ a known $N\times N$ matrix, and $x$ the unknown $N\times 1$ vector for which has to be solved. The $\exp$ is defined elementwise on the $x$ vector. I tried to search the Matlab-manual but I'm having a hard time finding how to solve this kind of equations with Matlab, so I hope someone can help me out.

• Maybe you could ask this question at stackoverflow. – thanasissdr Oct 3 '15 at 13:35
• I changed $N\text{x}N$ to $N\times N$. That is standard. ${}\qquad{}$ – Michael Hardy Oct 3 '15 at 13:54
• Cross-post: stackoverflow.com/questions/32923520/… – WG- Oct 6 '15 at 11:41
• I posted it on stackoverflow, on advise of thanasissdr :) – yarnamc Oct 7 '15 at 21:03

The function can be written in the form:

$$f \left( x \right) = A x + \exp \left( x \right) - b$$

Which is equivalent to the above once a root of $f \left( x \right)$ is found.
One could use Newton's Method for root finding.

The Jacobian (Like the Transpose of Gradient) of $f \left( x \right)$ is given by:

$$J \left( f \left( x \right) \right) = A + diag \left( \exp \left( x \right) \right)$$

Hence the newton iteration is given by:

$${x}^{k + 1} = {x}^{k} - { J \left( f \left( {x}^{k} \right) \right) }^{-1} f \left( {x}^{k} \right)$$

You can see the code in my Mathematics Q1462386 GitHub Repository which includes both analytic and numerical derivation of the Jacobian.

This is the result of one run:

Pay attention that while it finds a root for this problem there are more than 1 root hence the solution is one of many and depends on the initial point.