1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Brushing up on ODEs

  1. Oct 23, 2015 #1
    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. jcsd
  3. Oct 23, 2015 #2


    User Avatar
    Science Advisor
    Homework Helper
    2017 Award

    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 :smile: 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​
  4. Oct 27, 2015 #3
    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.
  5. Oct 27, 2015 #4


    User Avatar
    Science Advisor
    Homework Helper
    2017 Award

    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. :smile: 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...)

  6. Oct 28, 2015 #5


    User Avatar
    Science Advisor

    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:
    [itex]x_3''= -2x_1'- 3x_2'- 4x_3'[/itex]. Replace the derivatives of [itex]x_1[/itex] and [itex]x_2[/itex] from the first two equations: [itex]x_3''= -2x_2- 3x_3- 4x_3'[/itex]. Differentiate again: [itex]x_3'''= -2x_2'- 3x_3'- 4x_3''[/itex] which is the same as the "third order linear differential equation with constant coefficients", [itex]x_3''+ 4x_3''+ 3x_3'+ 2x_3[/itex] which has characteristic equation [itex]r^3+ 4r^2+ 3r+ 2= 0[/itex]

    Second, more "sophisticated" method: write this linear system as a matrix equation. We can write
    [tex]\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}[/tex]
    Simplify that by finding the eigenvalues and corresponding eigenvectors for that three by three matrix.
  7. Oct 28, 2015 #6

    Ray Vickson

    User Avatar
    Science Advisor
    Homework Helper

    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:
    [tex] \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
    This implies
    [tex] \pmatrix{r & -1 & 0 \\
    0 & r & -1 \\
    2 & 3 & r+4} \pmatrix{A\\B\\C\\} = \pmatrix{0\\0\\0} [/tex]
    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.
  8. Oct 28, 2015 #7


    User Avatar
    Science Advisor
    Homework Helper
    2017 Award

    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 !
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted