24小时热门版块排行榜    

查看: 1405  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 材料工程专硕274一志愿211求调剂 +5 薛云鹏 2026-03-15 5/250 2026-03-15 20:38 by Logic2024
[考研] 一志愿985,本科211,0817化学工程与技术319求调剂 +3 Liwangman 2026-03-15 3/150 2026-03-15 18:16 by JourneyLucky
[考研] 311求调剂 +3 26研0 2026-03-15 3/150 2026-03-15 09:12 by JourneyLucky
[考研] 289求调剂 +5 步川酷紫123 2026-03-11 5/250 2026-03-15 00:45 by kruisytel
[考研] 080500,材料学硕302分求调剂学校 +4 初识可乐 2026-03-14 5/250 2026-03-14 21:08 by peike
[考研] 材料与化工 323 英一+数二+物化,一志愿:哈工大 本人本科双一流 +4 自由的_飞翔 2026-03-13 5/250 2026-03-14 19:39 by hmn_wj
[考研] 255求调剂 +3 李嘉慧, 2026-03-12 4/200 2026-03-14 16:58 by 有只狸奴
[考研] 266求调剂 +4 学员97LZgn 2026-03-13 4/200 2026-03-14 08:37 by zhukairuo
[考研] 求调剂 +5 鹤遨予卿 2026-03-09 5/250 2026-03-14 02:44 by JourneyLucky
[考研] 307求调剂 +7 超级伊昂大王 2026-03-10 7/350 2026-03-14 00:49 by JourneyLucky
[考研] 材料工程专硕,一志愿中国矿业大学,总分314,求调剂 +5 无懈可击的巨人 2026-03-10 5/250 2026-03-14 00:37 by JourneyLucky
[考研] 311求调剂 +5 牛乳糖的卡卡 2026-03-10 5/250 2026-03-14 00:05 by JourneyLucky
[考研] 材料工程调剂 +9 咪咪空空 2026-03-12 9/450 2026-03-13 22:05 by 星空星月
[考研] 314求调剂 +7 无懈可击的巨人 2026-03-12 7/350 2026-03-13 15:40 by JourneyLucky
[考研] 求调剂 +3 程雨杭 2026-03-12 3/150 2026-03-13 15:06 by JourneyLucky
[考研] 085600材料与化工 309分请求调剂 +7 dtdxzxx 2026-03-12 8/400 2026-03-13 14:43 by jxchenghu
[考研] 083000环境科学与工程调剂 +8 mingmingry 2026-03-09 9/450 2026-03-11 10:23 by 沙漠之狐994
[考研] 化工0817调剂 +8 灿若星晨 2026-03-10 8/400 2026-03-10 22:44 by 星空星月
[考研] 298求调剂 +3 Vv呀! 2026-03-10 3/150 2026-03-10 22:40 by 剑诗杜康
[考研] 294 英二数二物化 求调剂 +6 米饭团不好吃 2026-03-09 6/300 2026-03-09 23:55 by barlinike
信息提示
请填处理意见