I can numerically solve this system using ode45 (as i understand this is very similar to the runge kutta 4th order method) in matlab no problem:




With initial conditions $x_1=-1.31, x_2=-7.32, x_3=3.35$.

However when adding the fourth equation:


ode45 does not give me the correct solution. The fourth equation has derivatives $x_1'$ and $x_2'$ and I am unsure if I need to make a transformation in order to solve, or use a different method entirely.

  • $\begingroup$ Did you substitute $x_1'$ and $x_2'$ into your equation for $x_4'$? In other words, let $x_4'=\frac{(1-5x_1^2-x_2)x_1- (x_2-x_1^3+3x_1^2-x_3-3.25)x_2}{x_1^2+x_2^2}$? $\endgroup$
    – Kyle
    Commented Mar 31, 2018 at 16:24
  • $\begingroup$ this was my first thought, but it does not give the expected result $\endgroup$ Commented Mar 31, 2018 at 18:08

1 Answer 1


ode45 is a Runge-Kutta embedded method. Since you have the explicit value of $x_1'$ and $ x_2 '$ you just need to put them in $x_4'$. Once you've found the initial condition for $x_4$, your system becomes:

$$\begin{cases} x_1'=\dots \\ x_2'=\dots \\ x_3'=\dots \\ x_4'=\frac{(1-5x_1^2-x_2)x_1- (x_2-x_1^3+3x_1^2-x_3-3.25)x_2}{x_1^2+x_2^2} \\ \vec{x(0)}= [-1.31,-7.32,3.35,x_4(0)]^T \end{cases}$$

A numerical computation of the system, using $x_4(0)=-0.85$, using ode45 in MatLab gives the following numerical solution Plot of the solution

  • $\begingroup$ Thanks for your reply, this looks promising. Is there any chance you could send me the code you used? $\endgroup$ Commented Mar 31, 2018 at 19:17
  • $\begingroup$ I can't see the difficult in writing this code: if your code worked for the system with three equations, you just have to add one equation to your system with the respective initial condition. I just used the MatLab odesolver ode45. Anyway, how can I send you the code? $\endgroup$
    – VoB
    Commented Apr 1, 2018 at 9:54
  • $\begingroup$ If you think that my post has answered to your questions, please mark it as accepted answer $\endgroup$
    – VoB
    Commented Feb 28, 2019 at 18:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .