Solving ODEs with Forward Euler & Sampled Data Systems

  • Thread starter Thread starter adoprea
  • Start date Start date
  • Tags Tags
    Odes
Click For Summary

Homework Help Overview

The discussion revolves around converting a set of differential equations related to a sampled data system into difference equations using the forward Euler integration algorithm. The equations involve three variables and their derivatives, with a specified step size for integration.

Discussion Character

  • Exploratory, Assumption checking, Problem interpretation

Approaches and Questions Raised

  • Participants discuss the initial steps needed to apply the forward Euler method, with some expressing confusion about starting points and the lack of initial conditions. There is mention of differentiating equations and the potential for looping in calculations. Others suggest alternative methods, including matrix representation and characteristic equations.

Discussion Status

The discussion is ongoing, with participants sharing their thoughts on the problem setup and exploring different methods to approach the equations. Some have provided insights that may help clarify the path forward, while others express their frustrations and uncertainties about the material.

Contextual Notes

Participants note the absence of initial conditions, which complicates the problem. There is also a recognition that the book's request is for a path to the solution rather than a complete resolution of the equations.

adoprea
Messages
5
Reaction score
0

Homework Statement


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.

Homework Equations


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

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!
 
Physics news on Phys.org
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​
 
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.
 
adoprea said:
There are no initial conditions. The book asks for a path to the solution, not actually solving the equations.
The better !
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.
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...)

--
 
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.
 
adoprea said:
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.

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 &amp;\Rightarrow&amp; r A = B \\<br /> \dot{x_2}= x_3 &amp; \Rightarrow &amp; r B = C \\<br /> \dot{x_3} = -2x_1-3x_2-4x_3 &amp;\Rightarrow &amp; r C = -2A - 3B - 4C<br /> \end{array}<br />
This implies
\pmatrix{r &amp; -1 &amp; 0 \\<br /> 0 &amp; r &amp; -1 \\<br /> 2 &amp; 3 &amp; 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.
 
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 !
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
6K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
8
Views
2K
  • · Replies 10 ·
Replies
10
Views
5K
  • · Replies 24 ·
Replies
24
Views
3K
  • · Replies 7 ·
Replies
7
Views
2K
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
Replies
1
Views
6K