# Brushing up on ODEs

1. Oct 23, 2015

### adoprea

1. The problem statement, all variables and given/known data
Sampled Data system
Using the forward Euler integration algorithm, convert these differential equations to a set of difference equations. Use a stept size of deltaT = 0.1s.

2. Relevant equations
x1(dot) = x2
x2(dot) = x3
x3(dot) = -2x1-3x2-4x3
y = 7x1-5x2

3. The attempt at a solution
Nothing relevant! I have scribbled around and played with stuff from wikipedia, mainly with the form yn = yn-1+deltaT*f(tn-1, yn-1), but to no avail. Do I start with:
dy/dt = 7x1(dot)-5x2(dot) and so on? I end up in a loop as soon as iI get to the derivation of x3. IIt doesn't feel like I am on the right path.

What I am looking for is the starting point (so far). I learned about this stuff in school about 5 years ago, but I haven't touched it ever since. Now I wanted to do some reading on system modeling and I thought I could give a go to the exercises in the book as well. First attempt, first failure. Help!

2. Oct 23, 2015

### BvU

With forward euler you shouldn't end up in a loop: you use $\vec x_n$ to calculate $\dot {\vec x}_n$ which you use to calculate $\vec x_{n+1}$.

Y is just a calculated variable $y(t) =y (\vec x(t))$. The differential equation is in $\vec x$

note: to actually solve, you need initial conditions (so it's funny you should ask where to start because without them the problem statement is incomplete)

Can't resist:
Ever tried. Ever failed.
No matter. Try Again.
Fail again. Fail better.

Samuel Beckett​

3. Oct 27, 2015

### adoprea

Haha! yes, "fail better" seems to apply here.

There are no initial conditions. The book asks for a path to the solution, not actually solving the equations. But your post gave me the starting point I was looking for.

The frustration I experience when I look at something that I was able to solve some years ago is infinite. I hope I am not the only one in this situation.

4. Oct 27, 2015

### BvU

The better !
This is a third order system. I don't think many people can solve that offhand; I sure can't. At first I thought I saw a glimpse of the equations for a harmonic oscillator, but that didn't last long.

Frustration is a self-imposed handicap. Unlike most other handicaps, you can throw it off: it doesn't help at all. And often, once you throw it aside, you find that it wasn't necessary in the first place (you know, like breaking in a door that isn't locked...)

--

5. Oct 28, 2015

### HallsofIvy

Staff Emeritus
There are two rather different ways to solve a system like this. The simpler (at least the method I learned first) is to differentiate the last equation again:
$x_3''= -2x_1'- 3x_2'- 4x_3'$. Replace the derivatives of $x_1$ and $x_2$ from the first two equations: $x_3''= -2x_2- 3x_3- 4x_3'$. Differentiate again: $x_3'''= -2x_2'- 3x_3'- 4x_3''$ which is the same as the "third order linear differential equation with constant coefficients", $x_3''+ 4x_3''+ 3x_3'+ 2x_3$ which has characteristic equation $r^3+ 4r^2+ 3r+ 2= 0$

Second, more "sophisticated" method: write this linear system as a matrix equation. We can write
$$\begin{bmatrix}x_1' \\ x_2' \\ x_3'\end{bmatrix}= \begin{bmatrix}0 & 1 & 0 \\ 0 & 0 & 1 \\ -2 & -3 & -4 \end{bmatrix}\begin{bmatrix}x_1 \\ x_2\\ x_3\end{bmatrix}$$
Simplify that by finding the eigenvalues and corresponding eigenvectors for that three by three matrix.

6. Oct 28, 2015

### Ray Vickson

Do you remember how you used to do it? I bet you started with the assumptions that $x_1 = A e^{rt}, x_2 = B e^{rt}, x_3 = C e^{rt}$, then substituted these into the DE's and turned the crank. Let's do that:
$$\begin{array}{ccl} \dot{x_1} = x_2 &\Rightarrow& r A = B \\ \dot{x_2}= x_3 & \Rightarrow & r B = C \\ \dot{x_3} = -2x_1-3x_2-4x_3 &\Rightarrow & r C = -2A - 3B - 4C \end{array}$$
This implies
$$\pmatrix{r & -1 & 0 \\ 0 & r & -1 \\ 2 & 3 & r+4} \pmatrix{A\\B\\C\\} = \pmatrix{0\\0\\0}$$
So, you need the determinant of the matrix to = 0 in order to have a non-vanishing solution, and that produces a cubic equation in $r$, Generally, there will be three roots $r_1, r_2, r_3$, so you will actually have solutions of the form $x_1 = A_1 e^{r_1 t} + A_2 e^{r_2 t} + A_3 e^{r_3 t}$, etc.

7. Oct 28, 2015

### BvU

Not sure ado is really interested in the actual solution (#1, #3). Could well be a step-up for a numerical solution exercise.
But still interesting !

Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted