Octave 八度lsode函数

Octave 八度lsode函数,octave,equation,dgl,Octave,Equation,Dgl,我写了下面的代码,它工作了几个星期没有任何问题。 它突然停止工作,出现以下错误: "warning: lsode: passing function body as a string is obsolete; please use anonymous functions warning: called from heun at line 23 column 2 error: 'f' undefined near line 1 column 42 error: lsode: evalua

我写了下面的代码,它工作了几个星期没有任何问题。 它突然停止工作,出现以下错误:

"warning: lsode: passing function body as a string is obsolete; please use anonymous functions
warning: called from
heun at line 23 column 2
error: 'f' undefined near line 1 column 42
error: lsode: evaluation of user-supplied function failed
error: called from
__lsode_fcn__C__ at line 1 column 40
heun at line 23 column 2"
代码是:

function yn=euler(t0,y0,tend,f,n)
t0=input('Gib hier t0 ein:');
y0=input('Gib hier y0 ein:');
tend=input('Bis zu welchem Wert von t möchtest du y annährn?');
n=input('Gib hier die Anzahl der Schritte ein(n):');
fstrich=input('Wie lautet die Differentialgleichung?', 's');
f=inline('fstrich');
dt=(tend-t0)/n;
t(1)=t0;
y(1)=y0;
for i=1:n
t(i+1)=t(i)+dt;
y(i+1)=y(i)+f(t(i),y(i))*dt;


rotdim([flip(t) ; flip(y)])
scatter(t,y,'*')
hold on
f=inline('fstrich');
t=t0:0.001:tend;
y=lsode('f',y0,t);
plot(t,y)

有人看到错误或我可以改变的东西吗?

显然你更新了八度

f=inline('fstrich'); % this is discouraged
y=lsode('f',y0,t); % and this is not valid anymore. 
相反,创建一个匿名函数

f=str2func(fstrich);
y=lsode(f,y0,t);

我把它改成了英语。很抱歉用德语发了出来。“突然它停止工作了”一定是有什么改变了。更新的软件版本?是的,看起来软件更新了,但我没有意识到。我收到了这个错误:错误:@y/(1+t^2):没有找到函数和方法错误:从euler第7行第2列调用>>@AdnZek right,因为y/(1+t^2)确实无效。尝试
@(y,t)(y/(1+t^2))
作为输入。它现在可以工作,但解决方案的绘图是错误的。但这不是初始值为(-3/1)的dgl的解决方案。请停止垃圾邮件,我不是来为您服务的,我在空闲时间免费帮助您,请注意这一点。在您的代码中,您正试图求解
y
的方程。为什么
y
是您输入的输入的一部分?您的输入字符串不依赖于
y
,这难道没有意义吗?我不确定你是否明白你想做什么,但如果你明白了,你能试着在原帖中解释一下吗?