24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 1446  |  回复: 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 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 一志愿南航,数一英一学硕317求调剂!! +5 Acaciad 2026-04-04 5/250 2026-04-05 12:31 by 搏击518
[考研] 081700学硕,323分,一志愿中国海洋大学求调剂学校 +16 披星河 2026-04-04 16/800 2026-04-05 11:27 by 猪会飞
[考研] 344材料与化工调剂 +9 调剂上岸玘 2026-04-03 9/450 2026-04-04 23:10 by happyddm
[考研] 求调剂 一志愿西南交通大学085701环境工程 282分 +5 多多爱吃汉堡 2026-04-04 5/250 2026-04-04 22:14 by 啵啵啵0119
[考研] 283求调剂 +4 mcbbc 2026-04-03 5/250 2026-04-04 20:51 by imissbao
[考研] 一志愿安徽某211 0703化学总分339求调剂 +6 晚风不晚 2026-04-04 6/300 2026-04-04 20:11 by dongzh2009
[考研] 291求调剂 +4 迷蒙木木 2026-04-01 5/250 2026-04-04 15:59 by sihailian3
[考研] 22408,264求调剂 +3 ywh729 2026-04-03 4/200 2026-04-04 11:04 by ywh729
[考研] 266求调剂 +8 学员97LZgn 2026-04-03 8/400 2026-04-04 09:02 by 20021109
[考研] 求调剂 +3 wos666 2026-04-03 3/150 2026-04-04 05:16 by gswylq
[考研] 考研调剂 +3 15615482637 2026-04-03 3/150 2026-04-03 22:50 by ms629
[考研] 319求调剂 +18 太容易1018 2026-04-01 18/900 2026-04-03 11:18 by linyelide
[考研] 08工科275分求调剂 +14 AaAa7420 2026-03-31 14/700 2026-04-03 11:13 by cocolv
[考研] 295求调剂 +7 愿旅途永远坦然 2026-04-02 7/350 2026-04-03 08:22 by fangshan711
[考研] 农学考研求调剂 +3 dkdkxm 2026-04-01 3/150 2026-04-02 16:04 by wangjagri
[考研] 求调剂 +4 DADA怪 2026-03-31 4/200 2026-04-01 14:30 by ZXlzxl0425
[考研] 材料调剂 +10 Eujd1 2026-03-31 11/550 2026-04-01 11:23 by ivanqyq
[考研] 【调剂】一志愿厦大生物与医药调剂 +3 Echo虾米 2026-03-31 3/150 2026-04-01 08:40 by JourneyLucky
[考研] 313求调剂 +6 卖个关子吧 2026-03-31 6/300 2026-03-31 10:58 by Jaylen.
[考研] 279求调剂 +12 j的立方 2026-03-29 12/600 2026-03-30 20:30 by dick_runner
信息提示
请填处理意见