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)-5
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/25 12:44:21
![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)-5](/uploads/image/z/6995987-35-7.jpg?t=matlab%E8%AF%AD%E6%B3%95%E6%9C%89%E9%97%AE%E9%A2%98%3F%3E%3E+f%3Dinline%28...%27%5Bx%282%29%3B+-2%2Ax%281%29-3%2Ax%282%29%2Bexp%28-5%2At%29%3B+x%284%29%3B+2%2Ax%281%29-3%2Ax%283%29-4%2Ax%282%29-4%2Ax%284%29-sin%28t%29%5D%27%2C...%27t%27%2C%27x%27%29%3B%5Bt1%2Cx1%5D%3Dode45%28f%2C%5B0%2C10%5D%2C%5B1%3B2%3B3%3B4%5D%29%3Bmatlab%E8%83%BD%E8%BF%90%E8%A1%8C%E7%9A%84%E5%BE%88%E5%A5%BD.%E4%BD%86%E6%98%AF%3E%3E+f%3Dinline%28%27%5B9%2Ay%281%29%2B24%2Ay%282%29%2B5%2Acos%28t%29-1%2F3%2Asin%28t%29%3B-24%2Ay%281%29-5)
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)-5
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(...'[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)-5
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) 这个括号要是 英文状态下的