- #1

- 58

- 0

It's been a while since I've played with systems of ODEs, and I seem to have forgotten some of the tricks. As an example, I have two coupled nonlinear DE that I want to convert to a system of four 1st order nonlinear DE. But, the normal way of making variable substitutions is not working of me.

Two 2nd order nonlinear DE:

##\ddot{\alpha} + \ddot{\beta}cos(\alpha-\beta)+\dot{\beta}^2sin(\alpha-\beta)=\tau_{1}##

##\ddot{\beta} + \ddot{\alpha}cos(\alpha-\beta)-\dot{\alpha}^2sin(\alpha-\beta)=\tau_{2}##

If I substitute variables ##x_1=\alpha##, ##x_2=\dot{\alpha}##,##x_3=\beta##,##x_4=\dot{\beta}##, like my initial reaction was, I get:

##\dot{x_1}=x_2##

##\dot{x_2}=-\dot{x_4}cos(x_1-x_3)-x_4^2sin(x_1-x_3)+\tau_1##

##\dot{x_3}=x_4##

##\dot{x_4}=-\dot{x_2}cos(x_1-x_3)+x_2^2sin(x_1-x_3)+\tau_2##

which isn't quite right, since it is not in the form ##\dot{\vec{\textbf{x}}}=\vec{\textbf{f}}(t,\vec{\textbf{x}})##

I'm trying to get it a form where I can run it through ODE45 or a similar solver.

Refresh my memory! :)

EDIT! I believe I figured it out. I did do it right, just implementing it in Matlab had me confused. But, all I have to do in my function is use the old values for ##\dot{x_2}## and ##\dot{x_4}##. Seeing those derivatives in the rhs just threw me off. Is this the right way to go about it?

Two 2nd order nonlinear DE:

##\ddot{\alpha} + \ddot{\beta}cos(\alpha-\beta)+\dot{\beta}^2sin(\alpha-\beta)=\tau_{1}##

##\ddot{\beta} + \ddot{\alpha}cos(\alpha-\beta)-\dot{\alpha}^2sin(\alpha-\beta)=\tau_{2}##

If I substitute variables ##x_1=\alpha##, ##x_2=\dot{\alpha}##,##x_3=\beta##,##x_4=\dot{\beta}##, like my initial reaction was, I get:

##\dot{x_1}=x_2##

##\dot{x_2}=-\dot{x_4}cos(x_1-x_3)-x_4^2sin(x_1-x_3)+\tau_1##

##\dot{x_3}=x_4##

##\dot{x_4}=-\dot{x_2}cos(x_1-x_3)+x_2^2sin(x_1-x_3)+\tau_2##

which isn't quite right, since it is not in the form ##\dot{\vec{\textbf{x}}}=\vec{\textbf{f}}(t,\vec{\textbf{x}})##

I'm trying to get it a form where I can run it through ODE45 or a similar solver.

Refresh my memory! :)

EDIT! I believe I figured it out. I did do it right, just implementing it in Matlab had me confused. But, all I have to do in my function is use the old values for ##\dot{x_2}## and ##\dot{x_4}##. Seeing those derivatives in the rhs just threw me off. Is this the right way to go about it?

Last edited: