matlab解微分方程组出现错误程序如下:function f=shier(t,x)f(1)=x(3)*x(1)*(1-x(1)/0.23)-0.2*x(1)*x(2);f(2)=0.2*x(1)*x(2)-0.18*x(2)-0.2*x(2);f(3)=0.18*x(2)-0.1*x(3);然后这个就出现错误了:Input argument "x" is undefined.Error in
来源:学生作业帮助网 编辑:作业帮 时间:2024/07/12 04:16:21
![matlab解微分方程组出现错误程序如下:function f=shier(t,x)f(1)=x(3)*x(1)*(1-x(1)/0.23)-0.2*x(1)*x(2);f(2)=0.2*x(1)*x(2)-0.18*x(2)-0.2*x(2);f(3)=0.18*x(2)-0.1*x(3);然后这个就出现错误了:Input argument](/uploads/image/z/13875130-10-0.jpg?t=matlab%E8%A7%A3%E5%BE%AE%E5%88%86%E6%96%B9%E7%A8%8B%E7%BB%84%E5%87%BA%E7%8E%B0%E9%94%99%E8%AF%AF%E7%A8%8B%E5%BA%8F%E5%A6%82%E4%B8%8B%EF%BC%9Afunction+f%3Dshier%28t%2Cx%29f%281%29%3Dx%283%29%2Ax%281%29%2A%281-x%281%29%2F0.23%29-0.2%2Ax%281%29%2Ax%282%29%3Bf%282%29%3D0.2%2Ax%281%29%2Ax%282%29-0.18%2Ax%282%29-0.2%2Ax%282%29%3Bf%283%29%3D0.18%2Ax%282%29-0.1%2Ax%283%29%3B%E7%84%B6%E5%90%8E%E8%BF%99%E4%B8%AA%E5%B0%B1%E5%87%BA%E7%8E%B0%E9%94%99%E8%AF%AF%E4%BA%86%EF%BC%9AInput+argument+%22x%22+is+undefined.Error+in)
matlab解微分方程组出现错误程序如下:function f=shier(t,x)f(1)=x(3)*x(1)*(1-x(1)/0.23)-0.2*x(1)*x(2);f(2)=0.2*x(1)*x(2)-0.18*x(2)-0.2*x(2);f(3)=0.18*x(2)-0.1*x(3);然后这个就出现错误了:Input argument "x" is undefined.Error in
matlab解微分方程组出现错误
程序如下:
function f=shier(t,x)
f(1)=x(3)*x(1)*(1-x(1)/0.23)-0.2*x(1)*x(2);
f(2)=0.2*x(1)*x(2)-0.18*x(2)-0.2*x(2);
f(3)=0.18*x(2)-0.1*x(3);
然后这个就出现错误了:
Input argument "x" is undefined.
Error in ==> shier at 2
f(1)=x(3)*x(1)*(1-x(1)/0.23)-0.2*x(1)*x(2);
Input argument "x" is undefined.
Error in ==> shier at 2
f(1)=x(3)*x(1)*(1-x(1)/0.23)-0.2*x(1)*x(2);
然后我没管错误,直接在workspace输入:
[t,x]=ode45(@shier,[0 30],[70;20;10])
然后出现下面错误了:
Error using ==> funfun\private\odearguments
SHIER must return a column vector.
Error in ==> ode45 at 173
[neq,tspan,ntspan,next,t0,tfinal,tdir,y0,f0,odeArgs,..
matlab解微分方程组出现错误程序如下:function f=shier(t,x)f(1)=x(3)*x(1)*(1-x(1)/0.23)-0.2*x(1)*x(2);f(2)=0.2*x(1)*x(2)-0.18*x(2)-0.2*x(2);f(3)=0.18*x(2)-0.1*x(3);然后这个就出现错误了:Input argument "x" is undefined.Error in
function f=shier(t,x)
f(1)=x(3)*x(1)*(1-x(1)/0.23)-0.2*x(1)*x(2);
f(2)=0.2*x(1)*x(2)-0.18*x(2)-0.2*x(2);
f(3)=0.18*x(2)-0.1*x(3);
改为
function f=shier(t,x)
f=zeros(3,1); %% 很重要
f(1)=x(3)*x(1)*(1-x(1)/0.23)-0.2*x(1)*x(2);
f(2)=0.2*x(1)*x(2)-0.18*x(2)-0.2*x(2);
f(3)=0.18*x(2)-0.1*x(3);
end