フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Query regarding solving differential equation

2 ビュー (過去 30 日間)
Bharath Ram
Bharath Ram 2018 年 5 月 24 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I'm trying to solve equation of a mass damper system shown in the image. The x (LHS) is the unknown displacement which is to be solved from the equation.I know y and dy/dx values at each instant of time (obtained from experiments). While solving using ode45 I'm not able to update the value of y and dy/dx for each time interval. How else can I solve the equation to get value of x. I used central difference scheme but the answer is diverging from the expected values drastically, when marched in time. Thank you in advance.

回答 (2 件)

sloppydisk
sloppydisk 2018 年 5 月 24 日
I'm guessing you are trying to use ode45 with variable timestep, make sure to pass y and dy/dx as an interpolation function such that it is defined for any point in time. For example like this:
yInterp = @(thisTime) interp1(t, y, thisTime);

Torsten
Torsten 2018 年 5 月 24 日
編集済み: Torsten 2018 年 5 月 24 日
The example
ODE with Time-Dependent Terms
under
https://de.mathworks.com/help/matlab/ref/ode45.html
shows how to solve your problem using ODE45.
Your y and dy/dt should take the role of f and g in the example.
Best wishes
Torsten.

この質問は閉じられています。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by