123
返回列表 发新帖
楼主: 李梦博1234

[已解决] 求解非线性方程组时计算时间太长,是不是程序有问题呢?

[复制链接]

新手

7 麦片

财富积分


050


2

主题

17

帖子

0

最佳答案
 楼主| 发表于 2018-12-7 22:24:37 | 显示全部楼层
shihe 发表于 2018-12-7 15:25
1:Matlab里的Log()函数在1stOpt对应的应该是Ln();
2:原先你最后一个公式是:log((Ga*T1-1000)/T5)-log(( ...

大神,您能帮我用1stopt算个例子吗?1.5的算不了。带有循环的,有个变量x.
  1. Constant Gh=400,Gc=500,Wnet=500,Qc=1000,Qh=1500,Thi=303,Tci=293;
  2. Parameters x1[20,30],x2[20,30],x3[20,30];
  3. LoopConstant  x[1:0.5:50];
  4. PlotLoopData  x[x],x1;
  5. PlotLoopData  x[x],x2;
  6. PlotLoopData  x[x],x3;
  7. Function   x4*(((Tci - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))*(((Qc + Wnet)*(exp(x1/x3)/x3^2 - exp(x1/Gh)/Gh^2))/(exp(x1/x3) - exp(x1/Gh)) - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh)^2)/(exp(x1/x3) - exp(x1/Gh))^2))/(Thi - (Qc + Wnet)/x3 - Qm/x3 + ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)))^2 - ((((Qc + Wnet)*(exp(x1/x3)/x3^2 - exp(x1/Gh)/Gh^2))/(exp(x1/x3) - exp(x1/Gh)) - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh)^2)/(exp(x1/x3) - exp(x1/Gh))^2)*(Tci + Qc/x3 + Qm/x3 - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc))))/(Thi + ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)))^2) + x5*((((Qc + Wnet)*(exp(x1/x3)/x3^2 - exp(x1/Gh)/Gh^2))/(exp(x1/x3) - exp(x1/Gh)) - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh)^2)/(exp(x1/x3) - exp(x1/Gh))^2)/((1/x + 1/x3)*(Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 + Qm/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))) - ((((Qc + Wnet)*(exp(x1/x3)/x3^2 - exp(x1/Gh)/Gh^2))/(exp(x1/x3) - exp(x1/Gh)) - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh)^2)/(exp(x1/x3) - exp(x1/Gh))^2)*(Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc))))/((1/x + 1/x3)*(Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 + Qm/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))^2)) + 1=0;

  8. x5*(((Qc*(exp(x2/x3)/x3^2 - exp(x2/Gc)/Gc^2))/(exp(x2/x3) - exp(x2/Gc)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc)^2)/(exp(x2/x3) - exp(x2/Gc))^2)/((1/x + 1/x3)*(Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 + Qm/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))) - (((Qc*(exp(x2/x3)/x3^2 - exp(x2/Gc)/Gc^2))/(exp(x2/x3) - exp(x2/Gc)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc)^2)/(exp(x2/x3) - exp(x2/Gc))^2)*(Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc))))/((1/x + 1/x3)*(Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 + Qm/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))^2)) + x4*(((Qc*(exp(x2/x3)/x3^2 - exp(x2/Gc)/Gc^2))/(exp(x2/x3) - exp(x2/Gc)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc)^2)/(exp(x2/x3) - exp(x2/Gc))^2)/(Thi - (Qc + Wnet)/x3 - Qm/x3 + ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh))) - ((Qc*(exp(x2/x3)/x3^2 - exp(x2/Gc)/Gc^2))/(exp(x2/x3) - exp(x2/Gc)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc)^2)/(exp(x2/x3) - exp(x2/Gc))^2)/(Thi + ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)))) + 1=0;

  9. - x4*(((Qc*(exp(x2/x3)/x3^2 + (x2*exp(x2/x3))/x3^3))/(exp(x2/x3) - exp(x2/Gc)) - (Qc*x2*exp(x2/x3)*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(x3^2*(exp(x2/x3) - exp(x2/Gc))^2))/(Thi - (Qc + Wnet)/x3 - Qm/x3 + ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh))) + (Qc/x3^2 + Qm/x3^2 - (Qc*(exp(x2/x3)/x3^2 + (x2*exp(x2/x3))/x3^3))/(exp(x2/x3) - exp(x2/Gc)) + (Qc*x2*exp(x2/x3)*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(x3^2*(exp(x2/x3) - exp(x2/Gc))^2))/(Thi + ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh))) - ((((Qc + Wnet)*(exp(x1/x3)/x3^2 + (x1*exp(x1/x3))/x3^3))/(exp(x1/x3) - exp(x1/Gh)) - (x1*exp(x1/x3)*(Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(x3^2*(exp(x1/x3) - exp(x1/Gh))^2))*(Tci + Qc/x3 + Qm/x3 - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc))))/(Thi + ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)))^2 - ((Tci - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))*((Qc + Wnet)/x3^2 + Qm/x3^2 - ((Qc + Wnet)*(exp(x1/x3)/x3^2 + (x1*exp(x1/x3))/x3^3))/(exp(x1/x3) - exp(x1/Gh)) + (x1*exp(x1/x3)*(Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(x3^2*(exp(x1/x3) - exp(x1/Gh))^2)))/(Thi - (Qc + Wnet)/x3 - Qm/x3 + ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)))^2) - x5*((Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))/(x3^2*(1/x + 1/x3)^2*(Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 + Qm/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))) - ((Qc + Wnet)/x3^2 + Qc/x3^2 - (Qc*(exp(x2/x3)/x3^2 + (x2*exp(x2/x3))/x3^3))/(exp(x2/x3) - exp(x2/Gc)) - ((Qc + Wnet)*(exp(x1/x3)/x3^2 + (x1*exp(x1/x3))/x3^3))/(exp(x1/x3) - exp(x1/Gh)) + (x1*exp(x1/x3)*(Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(x3^2*(exp(x1/x3) - exp(x1/Gh))^2) + (Qc*x2*exp(x2/x3)*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(x3^2*(exp(x2/x3) - exp(x2/Gc))^2))/((1/x + 1/x3)*(Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 + Qm/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))) + ((Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))*((Qc + Wnet)/x3^2 + Qc/x3^2 + Qm/x3^2 - (Qc*(exp(x2/x3)/x3^2 + (x2*exp(x2/x3))/x3^3))/(exp(x2/x3) - exp(x2/Gc)) - ((Qc + Wnet)*(exp(x1/x3)/x3^2 + (x1*exp(x1/x3))/x3^3))/(exp(x1/x3) - exp(x1/Gh)) + (x1*exp(x1/x3)*(Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(x3^2*(exp(x1/x3) - exp(x1/Gh))^2) + (Qc*x2*exp(x2/x3)*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(x3^2*(exp(x2/x3) - exp(x2/Gc))^2)))/((1/x + 1/x3)*(Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 + Qm/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))^2))=0;

  10. (Tci + Qc/x3 + Qm/x3 - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))/(Thi + ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh))) - (Tci - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))/(Thi - (Qc + Wnet)/x3 - Qm/x3 + ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)))=0;

  11. x - (Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc)))/((1/x + 1/x3)*(Tci - Thi + (Qc + Wnet)/x3 + Qc/x3 + Qm/x3 - ((Qc + Wnet)*(exp(x1/x3)/x3 - exp(x1/Gh)/Gh))/(exp(x1/x3) - exp(x1/Gh)) - (Qc*(exp(x2/x3)/x3 - exp(x2/Gc)/Gc))/(exp(x2/x3) - exp(x2/Gc))))=0;

  12. Qm=(Thi+((exp(x1/x3)/x3-exp(x1/Gh)/Gh)/(exp(x1/x3)-exp(x1/Gh)))*Qh-Qh/x3-(Tci-((exp(x2/Gc)/Gc-exp(x2/x3)/x3)/(exp(x2/Gc)-exp(x2/x3)))*Qc+Qc/x3))/(1/x+1/x3);
复制代码

论坛优秀回答者

中级

856 麦片

财富积分


5001500


0

主题

2186

帖子

186

最佳答案
  • 关注者: 120
发表于 2018-12-8 12:44:49 | 显示全部楼层
取x间隔为5(0.5计算太多,楼主自己动手):

循环常数 x        目标函数值        x1        x2        x3        x4        qm        x5
1        1.98241361779622E-28        25.5857031238083        24.2725786891944        26.1800183780281        1118.9888310579        68.9565676629959        233.564434949508
6        2.10475485083952E-27        28.6133844781004        26.9117557943357        20.52614328432        1013.40293923683        249.578736322549        4.40276406718002
11        1.10096208975484E-26        29.5046983518692        28.2713877704266        28.1830071557527        1603.31223363042        484.886504476941        -0.92450145320335
16        6.69295553525157E-27        29.4836598439811        28.0715086863627        23.0670382053449        1269.07521220205        520.576233616939        -0.192729198579379
21        2.43378336106266E-26        29.4582951468262        27.9731086620213        20.9987686697868        1139.38282205229        546.256876401079        -0.0724526392039181
26        6.54778278790355E-27        29.3982480746422        27.960725262386        20.9741989349282        1139.42219327046        604.705610407814        -0.106339573383887
31        3.98830971421837E-26        29.291550751656        27.8722101151047        20.6183629918567        1113.41096883054        640.760876524367        -0.0932902056407936
36        3.93057249152718E-26        29.2180247985344        27.9153136570596        21.8110528117435        1186.99583313301        730.398020377829        -0.139419837275902
41        1.9503217700957E-26        29.069989941268        27.7809848355694        21.4915195743392        1158.26940058201        756.413285745179        -0.113844962315452
46        3.77930563961193E-26        29.2727072235438        28.1629155184441        24.3867422511895        1356.74343140044        911.344741782394        -0.191155049734618
50        2.31967507408633E-26        29.06658797941        27.9501562690435        23.7459302627042        1300.29228530561        915.573885835901        -0.153694925762743

新手

7 麦片

财富积分


050


2

主题

17

帖子

0

最佳答案
 楼主| 发表于 2018-12-8 14:32:59 | 显示全部楼层
shihe 发表于 2018-12-8 12:44
取x间隔为5(0.5计算太多,楼主自己动手):

循环常数 x        目标函数值        x1        x2        x3        x4        qm        x5

非常感谢您
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

站长推荐上一条 /3 下一条

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