matlab语法有问题?

问题描述:

matlab语法有问题?
>> f=inline(...
'[x(2); -2*x(1)-3*x(2)+exp(-5*t); x(4); 2*x(1)-3*x(3)-4*x(2)-4*x(4)-sin(t)]',...
't','x');
[t1,x1]=ode45(f,[0,10],[1;2;3;4]);
matlab能运行的很好.
但是
>> f=inline('[9*y(1)+24*y(2)+5*cos(t)-1/3*sin(t);-24*y(1)-51*y(2)-9*cos(t)+1/3*sin(t)]',...
't','y');
>> [t1,y1]=ode45(f,[0,10],[1/3;2/3]);
就出错.
Error using ==> inlineeval at 15
Error in inline expression ==>
[9*y(1)+24*y(2)+5*cos(t)-1/3*sin(t);-24*y(1)-51*y(2)-9*cos(t)+1/3*sin(t)]
Error:The input character is not valid in MATLAB statements or expressions.
Error in ==> inline.feval at 36
INLINE_OUT_ = inlineeval(INLINE_INPUTS_,INLINE_OBJ_.inputExpr,INLINE_OBJ_.expr);
Error in ==> 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,...
1个回答 分类:综合 2014-11-07

问题解答:

我来补答
f=inline('[9*y(1)+24*y(2)+5*cos(t)-1/3*sin(t);-24*y(1)-51*y(2)-9*cos(t)+1/3*sin(t)]',...
't','y');
第二个y(2) 这个括号要是 英文状态下的
 
 
展开全文阅读
剩余:2000
下一页:填词谢谢