Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2008-04-28
年龄: 43
帖子: 1
声望力: 0 ![]() |
![]()
我的微分方程很简单,但不知道为什么老告诉我错误!请高手指点!
定义函数: 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); 请高手指点!不胜感激! |
![]() |
![]() |
![]() |
#2 |
高级会员
注册日期: 2007-12-02
年龄: 44
帖子: 303
声望力: 31 ![]() ![]() ![]() ![]() |
![]()
:biggrin: 我运行了,你有个特别小的问题
Function 这个地方弄错了 ,应该是 function 那个函数应该是这样的 function dy=concentraction(t,y,a,b,c,d) dy=a*y+b*(y-c)/(d+t); 并且 function dy 之间只有一个空格不是两个 |
![]() |
![]() |
![]() |
|
|
![]() |
||||
主题 | 主题作者 | 版面 | 回复 | 最后发表 |
[求助]神经网络的错误 | wangzhenhua0419 | MATLAB论坛 | 2 | 2009-06-15 19:40 |
【求助】关于等高图,谢谢 | tonny2316 | MATLAB论坛 | 1 | 2008-03-25 10:53 |
【求助】simpower模块中的Voltage Regulator具体的如何应用 | guanshuai | MATLAB论坛 | 0 | 2008-03-19 14:58 |
【求助】数组维数变换 | jane_8108 | MATLAB论坛 | 1 | 2008-01-10 11:47 |
【求助】请教用dsolve求解符号微分方程中的参数传递问题 | frcarpin | MATLAB论坛 | 0 | 2007-06-21 14:33 |