The stepsize of ode45 is not constant, but chosen such that the error tolerances you prescribe are met. Thus mean step size can only be controlled indirectly by strengthening (-> smaller stepsize) or weakening (-> larger stepsize) the error tolerances RelTol and AbsTol.
RelTol 为相对精度容差,用于控制计算答案中的正确位数。AbsTol 为绝对误差容限,用于控制计算答案与实际解之间的差异。在每个步长中,解分量 i 中的误差 e 将满足
|e(i)| ≤ max(RelTol*abs(y(i)),AbsTol(i))
粗略地讲,这意味着您希望 RelTol 更正所有解分量中的位数(但小于阈值 AbsTol(i) 的解分量除外)。当分量 y(i) 非常小时,即使您对此分量不感兴趣,您仍必须指定足够小的 AbsTol(i) 值,以便获取 y(i) 中的某些正确位数,从而准确计算您更感兴趣的分量。
At each step, the solver estimates the local error e in the ith component of the solution. This error must be less than or equal to the accept

ode45是一个数值求解常微分方程的工具,其步长不是恒定的,而是根据指定的相对误差RelTol和绝对误差AbsTol来调整以满足精度要求。RelTol控制解的相对精度,而AbsTol关注解与真实值的绝对差异。在每个步骤中,解的误差必须小于或等于这两个容忍度的较大值。若解的某个分量很小,即使不关心它,也可能需要设置较小的AbsTol以确保其他重要分量的计算精度。
最低0.47元/天 解锁文章
9366

被折叠的 条评论
为什么被折叠?



