I try to solve these two difference equation ;

$$ \frac{dq}{dz} = -j\left(b_1q - kp\right),\\ \frac{dp}{dz} = -j\left(b_2p - kq\right) $$

where $j$ stands for $\sqrt{-1}$, and $b_1$ ,$b_2$ and k are constants and $q(0)$, $p(0)$ are initial values and $z \in [0, 10]$.

I try to solve these equations analytically by assuming a general formula for the solution on the form $\exp(Cz)$ (where $C$ is a constant) and substitute this form into the two equations and get the solution shown in the attached image where $A$, $B$, $D$ constant related to $b_1$, $b_2$, $k$.

Is this solution correct or not? I try to get the solution numerically using matlab (using ode45 function) but I didn't get the same answer

enter image description here

  • 2
    $\begingroup$ In the second equation, should the term $b_2p$ be $b_2q$? Or isthe $-kp$ supposed to be $-kq$? It seems likely that one of those is true. $\endgroup$ – Ross Millikan Jun 24 '14 at 21:47
  • $\begingroup$ The original version featured $z = [0 \, 10]$ what was that supposed to mean? $\endgroup$ – mvw Jun 24 '14 at 22:06
  • $\begingroup$ @RossMillikan yes it should be a $kq$ in the second equation. My error. $\endgroup$ – Chinny84 Jun 24 '14 at 22:23

Instead of guessing an ansatz you can try to calculate the matrix $e^{Az}$ instead, once you put your first order system into matrix form:

$$ \underbrace{ \frac{d}{dz} \left[ \begin{matrix} q \\ p \end{matrix} \right] }_{x'} = \underbrace{ \left[ \begin{matrix} -i b_1 & i k \\ i k & -i b_2 \end{matrix} \right] }_A \, \underbrace{ \left[ \begin{matrix} q \\ p \end{matrix} \right] }_x \iff x'(z) = A \, x(z) $$

this has the solution

$$ x(z) = e^{Az} x(0) $$

Verifying your solution is just a matter of putting the solutions into the differential equation system and check if they fullfill them.

You should rather use a computer algebra system, if you don't like to calculate the derivatives by hand. Checking the numerical values is not bad as a first test, but less ensuring.

  • $\begingroup$ which computer program should i use to solve this type of problem numerically ? $\endgroup$ – M.F. Jun 25 '14 at 16:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.