24小时热门版块排行榜    

查看: 1009  |  回复: 3

zhs4276689

木虫 (正式写手)

[求助] 用matlab求解方程出问题,请帮忙看看

我求解一个方程,中间虽然解出来了,但还是有些问题,请帮忙看下
程序:
clc;
Ts=800; Cs=1134;ks=218;  Ps=2591;
Tm=933;
Cl=921;
z=0.65
as=ks/Cs/Ps

t=ks*(Tm-Ts)*exp(-z^2)/sqrt(as)/(1+erf(z))
f31=@(x)(t-(60.3+0.033*x)*(x-Tm)*exp(-z^2*as/(2.39e-5+1.9e-8*x))/sqrt(2.39e-5+1.9e-8*x)*erf(z*sqrt(as/(2.39e-5+1.9e-8*x))))
x=fsolve(f31,1100)
Ts
f(1)=t-(60.3+0.033*x)*(x-Tm)*exp(-z^2*as/(2.39e-5+1.9e-8*x))/sqrt(2.39e-5+1.9e-8*x)*erf(z*sqrt(as/(2.39e-5+1.9e-8*x)));
f

结果:

Equation solved, fsolve stalled.

fsolve stopped because the relative size of the current step is less than the
default value of the step size tolerance squared and the vector of function values
is near zero as measured by the default value of the function tolerance.




x =

  1.1734e+003


Ts =

   800


f =

-2.3283e-010

请问是什么问题?如何解决?谢谢!
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★ ★
感谢参与,应助指数 +1
zhs4276689(金币+5): 谢谢,继续帮我解答哦,呵呵 2012-03-05 16:28:18
clc;
Ts=800; Cs=1134;ks=218;  Ps=2591;
Tm=933;
Cl=921;
z=0.65
as=ks/Cs/Ps
t=ks*(Tm-Ts)*exp(-z^2)/sqrt(as)/(1+erf(z))
f31=@(x)(t-(60.3+0.033*x)*(x-Tm)*exp(-z^2*as/(2.39e-5+1.9e-8*x))/sqrt(2.39e-5+1.9e-8*x)*erf(z*sqrt(as/(2.39e-5+1.9e-8*x))))
[x,feval,exflag]=fsolve(f31,10,optimset('TolFun',1e-8))

[x,feval,exflag]=fsolve(f31,10,optimset('TolFun',1e-8))

Equation solved, fsolve stalled.

fsolve stopped because the relative size of the current step is less than the
default value of the step size tolerance squared and the vector of function values
is near zero as measured by the selected value of the function tolerance.




x =

  1.1734e+003


feval =

-2.3283e-010


exflag =

     2
我觉得,没什么大的问题,计算的值 -2.3283e-010距离0已经足够接近了,你如果还不满足,那需要调节一些参数。
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
2楼2012-03-05 15:38:56
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

zhs4276689

木虫 (正式写手)

引用回帖:
: Originally posted by dbb627 at 2012-03-05 15:38:56:
clc;
Ts=800; Cs=1134;ks=218;  Ps=2591;
Tm=933;
Cl=921;
z=0.65
as=ks/Cs/Ps
t=ks*(Tm-Ts)*exp(-z^2)/sqrt(as)/(1+erf(z))
f31=@(x)(t-(60.3+0.033*x)*(x-Tm)*exp(-z^2*as/(2.39e-5+1.9e-8*x))/sqrt(2.3 ...

就是中间出现提示,觉得不舒服。
另外我在用另一种方法进行求解时,也老出现这样的问题,或者说是solve 提前结束,但计算出的值距离0也很近,这样解出的结果可信吗?会不会根据赋值的不同,还会出现一个更适合实际的结果呢?
3楼2012-03-05 16:31:37
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
zhs4276689(金币+15): 谢谢! 2012-03-05 17:46:47
中间出现提示可以关闭,在optimset中设置一下,这个看你初值给的怎么样,一般来说你要求的精度不是非常高的话,是可以接受的
clc;
Ts=800; Cs=1134;ks=218;  Ps=2591;
Tm=933;
Cl=921;
z=0.65
as=ks/Cs/Ps
t=ks*(Tm-Ts)*exp(-z^2)/sqrt(as)/(1+erf(z))
f31=@(x)(t-(60.3+0.033*x)*(x-Tm)*exp(-z^2*as/(2.39e-5+1.9e-8*x))/sqrt(2.39e-5+1.9e-8*x)*erf(z*sqrt(as/(2.39e-5+1.9e-8*x))))
[x,feval,exflag]=fsolve(f31,10,optimset( 'Display','off',TolFun',1e-8))
x =

  1.1734e+003


feval =

-2.3283e-010


exflag =

     2

fsolve的exflag =     2 表示  2  Change in X too small. 可以认为已经收敛了

  1  FSOLVE converged to a root.
      2  Change in X too small.
      3  Change in residual norm too small.
      4  Computed search direction too small.
      0  Too many function evaluations or iterations.
     -1  Stopped by output/plot function.
     -2  Converged to a point that is not a root.
     -3  Trust region radius too small (Trust-region-dogleg) or
         Regularization parameter too large (Levenberg-Marquardt).
     -4  Line search failed.
The more you learn, the more you know, the more you know, and the more you forget. The more you forget, the less you know. So why bother to learn.
4楼2012-03-05 17:11:12
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 zhs4276689 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 刚刚收到科研之友邮件 +9 olivermiaoer 2024-06-19 11/550 2024-06-20 06:49 by kobe0107
[考博] 2025年博士申请,可先做科研助理 +3 limit888 2024-06-18 6/300 2024-06-20 02:43 by limit888
[基金申请] 工材口青年基金上会可能性 +5 今晚推荐22 2024-06-19 7/350 2024-06-20 01:49 by yifeng11
[考博] 有机化学迷茫学生 +4 佛系摸鱼5 2024-06-18 5/250 2024-06-20 00:05 by 佛系摸鱼5
[海外博后] 墨尔本大学博后offer要不要接 +3 kyxblmm 2024-06-18 3/150 2024-06-19 22:39 by blake1111
[基金申请] 面青地会评时间??? +5 Axvdvbfs 2024-06-19 5/250 2024-06-19 21:11 by 人民海军
[论文投稿] 有化学投稿的期刊推荐吗 20+3 荣小撇 2024-06-13 3/150 2024-06-19 19:29 by 瓦列利安
[考博] 34岁读博士晚吗 +39 emitdne 2024-06-13 39/1950 2024-06-19 19:03 by Dqtjs
[基金申请] 面上基金有一个(两个)C是不是就没戏了.... 5+4 zzzm116 2024-06-13 21/1050 2024-06-19 18:35 by 匿名374
[访问学者] 国家公派访问学者申请结果出了吗? +4 65syn 2024-06-13 4/200 2024-06-19 16:40 by 海洋之心168
[硕博家园] 关于硕博连读的一些疑问? +8 Lwenter 2024-06-14 10/500 2024-06-19 10:00 by qingdao001
[基金申请] 博后基金刷到的BUG,图片来的更直观 +15 carolloo 2024-06-17 16/800 2024-06-19 09:42 by msjy
[论文投稿] 审稿人含糊拒稿,还需要回复吗?如何回复? 20+4 BruceChum 2024-06-15 22/1100 2024-06-19 08:00 by kanyechris
[教师之家] 请问事业编制和年薪制冲突吗? +12 ZHONGWU_U 2024-06-14 12/600 2024-06-18 19:31 by fangyl2005
[硕博家园] 博士毕业高校和就业的相关问题 +7 SCITOPPP 2024-06-14 11/550 2024-06-18 07:51 by yinxing1995
[催化] 镍负载氧化铝的保存问题 8+3 lwn0130 2024-06-15 4/200 2024-06-17 10:48 by adaihao
[基金申请] 博后基金,博管会会提前知道消息吗? +4 yuyiang 2024-06-13 4/200 2024-06-16 11:40 by yangyuzhong4
[基金申请] 为什么我的博后基金还在流动站审核中?不会是学院给我卡了吧? +14 王凯12 2024-06-13 26/1300 2024-06-15 15:22 by 好人与坏人
[论文投稿] 投了一篇4区的SCI,审稿人一个拒稿,一个小修,编辑给了大修。 +9 安稳22123 2024-06-13 10/500 2024-06-14 23:45 by jurkat.1640
[基金申请] 工材E10口函评结束了吗 10+3 我1的飞翔 2024-06-13 5/250 2024-06-14 06:35 by nono2009
信息提示
请填处理意见