声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1360|回复: 8

[编程技巧] 用matlab求解常微分时的Warning

[复制链接]
发表于 2008-11-15 18:37 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
function hh
%options=odeset()
[t,y]=ode23t(@fun,0:0.01:5,0.5)
plot(t,y)
function dy=fun(t,y)
dy=(y^2+5)*(t+6);

结果:
Warning: Failure at t=9.940611e-002. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (3.531614e-016) at time t.
> In ode23t at 726
In try28 at 3

t =

0
0.0100
0.0200
0.0300
0.0400
0.0500
0.0600
0.0700
0.0800
0.0900


y =

0.5000
0.8275
1.1902
1.6108
2.1237
2.7926
3.7382
5.2505
8.2098
17.2406
请问要怎样才能避免Warning的出现?
多谢!
回复
分享到:

使用道具 举报

发表于 2008-11-15 19:48 | 显示全部楼层

回复 楼主 满城飞絮 的帖子

帮你顶一下
同问。 。。 。 。 。
发表于 2008-11-15 23:30 | 显示全部楼层

回复 楼主 满城飞絮 的帖子

变步长试试
 楼主| 发表于 2008-11-15 23:40 | 显示全部楼层
变了几次试过还是这样哈,我都觉得是步长的问题,但不知道要用什么样的步长才不会出现Warning!
发表于 2008-11-16 09:45 | 显示全部楼层
试试[t,y]=ode23t(@fun,[0 5],0.5)
doc ode23t
发表于 2008-11-16 11:09 | 显示全部楼层

回复 5楼 ch_j1985 的帖子

用了ode23t
修改了步长和总时间,
还是出现Warning: Failure at t=2.813557e-001.  Unable to meet integration tolerances without reducing the step size below the smallest value allowed (9.995763e-016) at time t.

继续请教。。。。
发表于 2008-11-16 11:57 | 显示全部楼层

回复 6楼 wxl789 的帖子

能否把常微分方程贴出来?
 楼主| 发表于 2008-11-16 14:33 | 显示全部楼层
dy/dx=(y^2+5)*(x+6).
x范围是0到5,y0=0.5
发表于 2008-11-17 09:48 | 显示全部楼层

回复 7楼 ch_j1985 的帖子

我那个方程是自己编写程序构造的,蛮复杂。

这个警告提示和具体的方程有关吗?
您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-9-23 03:24 , Processed in 0.056492 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表