How to solve transcendental equations with MATLAB?

4.6k Views Asked by At

Here's the equation:

$$ - \frac{MN}{\sqrt{2\pi \left( \sigma_1^2 + \sigma_2^2 \right)}} \frac d {dy} \exp \left( -\frac {y^2} {\left( \sigma_1^2 + \sigma_2^2 \right)} \right) = k \left( x-y \right) $$

About the equation(s):
The equation on the left side models an attraction force, the one on the right hand side a spring force. The parameters $ M, N, \sigma_1, \sigma_2 $ and $ k $ do not change. $ x $ is the distance to the initial position (fixed value, doesn't change) and $ y $ is the distance to the position (I'm looking for) where both forces are balanced.
I already tried solve, but that didn't really help me. I also read, that it should be solved numerically, but I don't really know how to do this in Matlab.
Thank you in advance

1

There are 1 best solutions below

0
On BEST ANSWER

For ease of notation let $$a = -\frac{MN}{k\sqrt{2\pi(\sigma_{1}^{2} + \sigma_{2}^{2})}}$$ and $$b = (\sigma_{1}^{2}+\sigma_{2}^{2}).$$ Then we would like to find $y$ such that $$- 2 y \frac{a}{b} \exp[-y^{2}/b] = x - y.$$ Equivalently, we would like to find the root of $f(y)$, where $$f(y) = y - 2y\frac{a}{b}\exp[-y^{2}/b] - x.$$

There are a number of ways to find roots numerically e.g. the bisection method, secant method or Newton's method.

I suggest you don't implement any of these yourself: rather just use MATLAB's fzero command - read its documentation here.