【发布时间】:2020-10-09 12:21:04
【问题描述】:
我尝试保存/查看在 ode45 微分方程求解过程中由 if 循环更改的变量 m。
%Some parameter setting above
myfun=fprintf('m', num2str(m))
options = odeset('NonNegative',[1:3],'RelTol',1e-5,'AbsTol',1e-8, 'OutputFcn', @myfun);
[t,x] = ode45('myfunction', tspan, x0, options); %calculation
if 循环在所有其他方程式之前位于方程式文件中:
if x(1)>=threshold
m=1 ;
return
else
m=0 ;
end
我已经查看了 ode45 的 OutputFcn 选项的 matlab 描述,还阅读了 https://de.mathworks.com/help/deeplearning/ug/customize-output-during-deep-learning-training.html 没有正确理解它。我也对其他解决方案持开放态度,以“查看”在 ode 计算期间 m 的值。
【问题讨论】:
-
你问题中的链接不是
ode相关的输出函数,ode outputFcn的相关信息见here -
谢谢,我也已经调查过这个链接。我刚刚提到了上面的第一个链接,因为我看到它推荐了关于 OutputFcn 的类似问题
标签: matlab variables output ode45