【问题标题】:Setting Up ODE45 Function设置 ODE45 函数
【发布时间】:2018-07-02 23:27:39
【问题描述】:

这可能是一个微不足道的问题,但我需要帮助设置以下 ODE 以使用 ODE45 解决:

4x" + 32x' + 60x = 3f'(t) + 2f(t), with initial conditions x(0) = 0, x'(0) = 0, and f(t) = 5t, from t = 0 to t = 1.5

进行替换,我得到以下结果:

4x" + 32x' + 60x = 15 + 10t,
x" = -8x' -15x +15/4 + 2.5t

并设置矢量:

x(1)' = x(2)
x(2)' = -8x(1) -15x + 15/4 + 2.5t

[t,x] = ode45(@(t,x) [x(2); -8.*x(1) - 15.*x + 15./4 + 2.5.*t],[0 1.5],[0 0]);

我收到以下错误:

Error using odearguments (line 92)
@(T,Y)[Y(2);-8.*Y(1)-15.*Y+15./4+2.5.*T] returns a vector of length 3, but the length of initial conditions vector is 2.
The vector returned by @(T,Y)[Y(2);-8.*Y(1)-15.*Y+15./4+2.5.*T] and the initial conditions vector must have the same number of elements.

我是否错误地设置了 ODE 表达式,或者我是否缺少初始条件?

【问题讨论】:

    标签: matlab modeling differential-equations ode45


    【解决方案1】:

    哎呀解决了。

    我没有意识到 x(2) 对应于 x',而 x(1) 对应于 x。进行必要的替换修复它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-04
      • 2012-08-31
      相关资源
      最近更新 更多