1

我想使用 odeplot 所以逐步得到结果,而不是事后绘制结果。我试过这样写,但我无法让它工作,所以我希望能得到一些帮助。

%Parameters

s = 1; 

q = 1; 

w = 0.1610;

y0 = [30 1 30]; % Initial values

tspan = [0 10]; % Time 0<t<10

plot=odeset('OutputFcn','odeplot');

[t, y] = ode45(@(t,y) concentration(t, y, s, q, w), plot, tspan, y0);
4

1 回答 1

2

您需要通过 ODE Options 参数指定输出函数:

options = odeset('OutputFcn', @odeplot);
[t, y] = ode45(@(t,y)concentration(t, y, s, q, w), tspan, y0, options);

当然你可以制作自己的自定义输出函数。键入edit odeplot以查看需要什么(可以使用更简单的功能)。还要检查odephas2odephas3

于 2013-05-19T20:59:45.237 回答