![]() |
求助! 关于ode45
我的微分方程很简单,但不知道为什么老告诉我错误!请高手指点!
定义函数: Function dy=concentraction(t,y,a,b,c,d) dy=a*y+b*(y-c)/(d+t); 求解: clear ts=0:1:3000; n=length(ts); x0=[6]; a=1; b=1; c=1; d=1; opt=odeset('RelTol',1e-6,'AbsTol',1e-9); ode45(@concentraction,ts,x0,opt,a,b,c,d); 错误提示: Warning: feval on script names will not work, or may work differently, in a future version of MATLAB. To make your code insensitive to any change and to suppress this warning message: - Either change the script to a function. - Or use eval instead of feval. The script file in question is concentraction. > In funfun\private\odearguments at 110 In ode45 at 173 In diffsolve at 10 ??? Attempt to execute SCRIPT concentraction as a function: C:\Documents and Settings\xltp5\My Documents\MATLAB\P+S+B\concentraction.m Error in ==> funfun\private\odearguments at 110 f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0. Error in ==> ode45 at 173 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ... Error in ==> diffsolve at 10 ode45(@concentraction,ts,x0,opt,a,b,c,d); 请高手指点!不胜感激! |
:biggrin: [SIZE="4"] 我运行了,你有个特别小的问题
[COLOR="Red"] Function [/COLOR] 这个地方弄错了 ,应该是 [COLOR="red"] function [/COLOR] 那个函数应该是这样的 function dy=concentraction(t,y,a,b,c,d) dy=a*y+b*(y-c)/(d+t); 并且 function dy 之间只有一个空格不是两个 [/SIZE] |
所有时间均为北京时间。现在的时间是 09:48。 |
Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.