# Second oder ode solution with euler methods

58 ビュー (過去 30 日間)
Bayram FURKAN TORA 2019 年 5 月 1 日
Edited: James Tursa 2019 年 5 月 2 日
𝟓𝒙̈+ 𝟕𝒙̇ + 𝟒𝒙 = 𝒔𝒊𝒏(𝟖𝒕) where, 𝒙(𝒕 = 𝟎) = 𝟓 and 𝒙̇(𝒕 = 𝟎) = 2 𝒙 values in the domain of [𝟎 𝟏𝟎]. with a step size of 𝚫𝒕 = 𝟎. 𝟓. How can I solve this system using euler methods ?

#### 4 件のコメント

Bayram FURKAN TORA 2019 年 5 月 1 日
I know solve first order ode but I don't know how to write script code to solve second ode
Erivelton Gualter 2019 年 5 月 1 日
Hello Bayram,
You can easily use the ODE solvers from Matlab. Check the link bellow:
Try to implement it and if you face a problem, share here your code and I will be glad to help.
Bayram FURKAN TORA 2019 年 5 月 1 日
Thank you James

サインイン to comment.

### 件の回答 (1)

James Tursa 2019 年 5 月 1 日

Rewrite your 2nd order equation as a pair of first order equations, then use Euler method on a 2-element vector. I.e.,
Define your 2-element state vector y as
y(1) is defined to be x
y(2) is defined to be xdot
The derivative of y(1) is y(2) by definition.
The derivative of y(2) can be found by solving your 2nd order DE for xdotdot.
See the van der Pol equation example in the doc here for an example of turning a 2nd order DE into a pair of 1st order DEs:
You can essentially use your 1st order Euler code as an outline for this 2nd order system. Simply replace the scalar state with a 2-element vector state in your code.

#### 0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。

Translated by