Matlab ode函数获取指定数量的values/outputs

Matlab ode functions to get specified number of values/outputs

我有一个包含我的微分方程的函数文件,我正在以标准形式对函数执行 ode23s,即 [t,m]=ode23s('DE_function',tspan,[mA pA mB pB mC pC mD],optionsDE,p)

我得到大约 150 values/results/output 每 mA 等等。我的 ode23s 工作正常。 我有相同 mA 的实验数据集等等,我必须用它来计算最小平方误差。我正在尝试这样做: a = m(:,1) - A(:,2);等等。在我的实验数据中,根据 20 个时间点,我只有 20 values/results/outputs 等。我也为 tspan 定义了相同的时间点。但是由于我的矩阵在维度上不匹配,我无法继续计算。有没有办法根据 ode23 中的 1、2 等 20 个时间点准确接收 20 个值,或者可能只是获取和存储它们的方法。

我一直在尝试为这个错误找到解决方案,但找不到合适的方法。非常感谢任何类型的建议和命中。

Matlab 文档有您需要的一切。当您调用 ode23 时,您可以在 tspan 中指定时间位置。

"Interval of integration, specified as a vector. At minimum, tspan must be a two element vector [t0 tf] specifying the initial and final times. To obtain solutions at specific times between t0 and tf, use a longer vector of the form [t0,t1,t2,...,tf]. The elements in tspan must be all increasing or all decreasing."