作业帮 > 综合 > 作业

matlab语法有问题?

来源:学生作业帮 编辑:搜狗做题网作业帮 分类:综合作业 时间:2024/04/29 14:21:52
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,...
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');
第二个y(2) 这个括号要是 英文状态下的