MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB基础] MATLAB,为什么能出现下面情况?应该怎么修改呢? (https://www.labfans.com/bbs/showthread.php?t=20739)

xichyu 2015-02-06 16:49

MATLAB,为什么能出现下面情况?应该怎么修改呢?
 
在Matlab下输入:edit,然后将下面两行百分号之间的内容,复制进去,保存
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function dx=myfun(t,x)
dx(1)=-6*x(2)*x(2)-9;
dx(2)=-3*x(1)*x(2)-2*x(3);
dx(3)=x(1)*x(2)+x(3)+8;
dx=dx(:);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

然后,在Matlab下面输入:
x0=[3,-4,2];
t0=0:0.1:2;
[t,x]=ode45('myfun',[0,2],x0); %ode45会自动调整步长
plot(t,x)
legend('u','v','Y')

运行结果出现Warning: Failure at t=1.280767e-001. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (4.440892e-016) at time t


显然不是需要的结果!!!


所有时间均为北京时间。现在的时间是 12:14

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.