24小时热门版块排行榜    

北京石油化工学院2026年研究生招生接收调剂公告
查看: 4340  |  回复: 16
当前只显示满足指定条件的回帖,点击这里查看本话题的所有回帖

sunjiahuan

铜虫 (小有名气)

[求助] matlab求解非线性方程组 已有1人参与

I1=(1.3403/0.323)*(354.3091/443.6719-lambertw((1.0885e-004/443.6719)*exp((330.7*x1+354.3091)/443.6719)))-x1/(0.323+330.7)+1.019*10^(-6)*(exp(x1/1.3403)-1);
I2=(1.3403/0.323)*(349.7334/437.9477-lambertw((1.0744e-004/437.9477)*exp((326.4292*x2+349.7334)/437.9477)))-x2/(0.323+326.4292)+1.019*10^(-6)*(exp(x2/1.3403)-1);
I3=(1.3403/0.323)*(337.973/423.2354-lambertw((1.0383e-004/423.2354)*exp((315.4524*x3+337.973)/423.2354)))-x3/(0.323+315.4524)+1.019*10^(-6)*(exp(x3/1.3403)-1);
I4=(1.3403/0.323)*(324.4644/406.3363-lambertw((9.9677e-005/406.3363)*exp((302.844*x4+324.4644)/406.3363)))-x4/(0.323+302.844)+1.019*10^(-6)*(exp(x4/1.3403)-1);
I5=1.019*10^(-6)*(exp(x5/1.3403)-1);
上面是5个方程,I1=f(x1),I2=f(x2),I3=f(x3),I4=f(x4),I5=f(x5); 关于方程里的lambertw函数,可以在附件(太阳电池I-V方程显示求解原理研究及应用中的第二章中找到)。

而要求解的方程组是由它们5个组成的,如下:
x1+x2+x3+x4+x5-30=0
I1-I2=0;
I1-I3=0;
I1-I4=0;
I1-I5=0;
上面的方程组已经写好,在fun.m里。

而在dfun.m 中是方程组里的每一个方程分别对x1,x2 x3 x4 x5 求一阶导数。其实就是求方程组的雅克比矩阵;

在newton.m里是求解的编程,是我在这个网上(http://hi.baidu.com/aillieo/blog ... c9a59647106493.html)找到的,只是把里面的方程及相关部分改了一下。

我在matlab里输入newton([0.01 0.01 0.01 0.01 0.01],0.00001,200)
最后得到的结果是
In newton at 6
Warning: Matrix is singular, close to singular or badly scaled.
         Results may be inaccurate. RCOND = NaN.
> In newton at 6

ans =

   NaN   NaN   NaN   NaN   NaN。
这种方法是好多学者用过的,得到的结果都挺好。所以方法应该没问题。因为我的matlab只学了个皮毛,不知道这里面哪出错了,还请各位高手给指点一下。
回复此楼

» 本帖附件资源列表

  • 欢迎监督和反馈:小木虫仅提供交流平台,不对该内容负责。
    本内容由用户自主发布,如果其内容涉及到知识产权问题,其责任在于用户本人,如对版权有异议,请联系邮箱:xiaomuchong@tal.com
  • 附件 1 : newton.m
  • 2012-02-22 16:56:51, 775 bytes
  • 附件 2 : dfun.m
  • 2012-02-22 16:56:51, 120 bytes
  • 附件 3 : fun.m
  • 2012-02-22 16:56:52, 969 bytes
  • 附件 4 : 太阳电池I_V方程显式求解原理研究及应用.nh
  • 2012-02-22 16:57:53, 4.29 M

» 收录本帖的淘帖专辑推荐

材料+新能源+催化+外语

» 猜你喜欢

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

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

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

ben_ladeng(金币+2): 谢谢应助 2012-02-22 21:58:25
ben_ladeng(专家考核): 2012-02-22 21:59:32
引用回帖:
5楼: Originally posted by sunjiahuan at 2012-02-22 20:53:37:
不好意思,刚看到I1,I2,I3,I4方程中最后一项的里的x1,x2,x3,x4, 应该为-x1,-x2,-x3,-x4,而x5不变。所以我附件里fun.m的方程组里的也要相应改变,因无法编辑,在此说明一下。比如I1中的最后一项1.019*10^(-6)*( ...

CODE:
function aa
[X,FVAL,EXITFLAG,OUTPUT] =fsolve(@fun,[18.7783   0.01   18.1315   18.0062  -2],optimset('MaxFunEvals',1000))
function f=fun(x)
x1=x(1);
x2=x(2);
x3=x(3);
x4=x(4);
x5=x(5);
f1=x1+x2+x3+x4+x5-30;
f2=4.1495*(0.7986-lambertw(2.4534e-007*exp((330.7*x1+354.3091)/443.6719)))-x1/331.0230+1.019e-6*(exp(-x1/1.3403)-1)-4.1495*(0.7986-lambertw(2.4533e-007*exp((326.4292*x2+349.7334)/437.9477)))+x2/(0.323+326.4292)-1.019*10^(-6)*(exp(-x2/1.3403)-1);
f3=4.1495*(0.7986-lambertw(2.4534e-007*exp((330.7*x1+354.3091)/443.6719)))-x1/331.0230+1.019e-6*(exp(-x1/1.3403)-1)-4.1495*(0.7985-lambertw(2.4532e-007*exp((315.4524*x3+337.973)/423.2354)))+x3/(0.323+315.4524)-1.019*10^(-6)*(exp(-x3/1.3403)-1);
f4=4.1495*(0.7986-lambertw(2.4534e-007*exp((330.7*x1+354.3091)/443.6719)))-x1/331.0230+1.019e-6*(exp(-x1/1.3403)-1)-4.1495*(0.7985-lambertw( 2.4531e-007*exp((302.844*x4+324.4644)/406.3363)))+x4/(0.323+302.844)-1.019*10^(-6)*(exp(-x4/1.3403)-1);
f5=4.1495*(0.7986-lambertw(2.4534e-007*exp((330.7*x1+354.3091)/443.6719)))-x1/331.0230+1.019e-6*(exp(-x1/1.3403)-1)-1.019*10^(-6)*(exp(x5/1.3403)-1);
f=[f1 f2 f3 f4 f5];

将上述代码拷到editor里面,存为.m文件,点击editor中run按钮
结果如下
Equation solved.

fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.




X =

   20.0741   20.0739   20.0728   20.0718  -50.2925


FVAL =

  1.0e-007 *

    0.0000   -0.8502   -0.8544   -0.8544   -0.8544


EXITFLAG =

     1


OUTPUT =

       iterations: 13
        funcCount: 74
        algorithm: 'trust-region dogleg'
    firstorderopt: 4.6500e-007
          message: [1x695 char]
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.
6楼2012-02-22 21:29:51
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
查看全部 17 个回答

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

感谢参与,应助指数 +1
ben_ladeng(金币+2): 谢谢应助 2012-02-22 21:59:15
ben_ladeng(专家考核): 2012-02-22 21:59:24
caemechanics(金币+5): 感谢应助 2012-02-23 16:18:30
错误提示信息是矩阵奇异,
可能初值不太合适
我用自带fsolve解了下
结果不是很好
[/code]
function aa
[X,FVAL,EXITFLAG,OUTPUT] =fsolve(@fun,[18.7783   0.01   18.1315   18.0062  -2],optimset('MaxFunEvals',1000))
function f=fun(x)
x1=x(1);
x2=x(2);
x3=x(3);
x4=x(4);
x5=x(5);
f1=x1+x2+x3+x4+x5-30;
f2=4.1495*(0.7986-lambertw(2.4534e-007*exp((330.7*x1+354.3091)/443.6719)))-x1/331.0230+1.019e-6*(exp(x1/1.3403)-1)-4.1495*(0.7986-lambertw(2.4533e-007*exp((326.4292*x2+349.7334)/437.9477)))+x2/(0.323+326.4292)-1.019*10^(-6)*(exp(x2/1.3403)-1);
f3=4.1495*(0.7986-lambertw(2.4534e-007*exp((330.7*x1+354.3091)/443.6719)))-x1/331.0230+1.019e-6*(exp(x1/1.3403)-1)-4.1495*(0.7985-lambertw(2.4532e-007*exp((315.4524*x3+337.973)/423.2354)))+x3/(0.323+315.4524)-1.019*10^(-6)*(exp(x3/1.3403)-1);
f4=4.1495*(0.7986-lambertw(2.4534e-007*exp((330.7*x1+354.3091)/443.6719)))-x1/331.0230+1.019e-6*(exp(x1/1.3403)-1)-4.1495*(0.7985-lambertw( 2.4531e-007*exp((302.844*x4+324.4644)/406.3363)))+x4/(0.323+302.844)-1.019*10^(-6)*(exp(x4/1.3403)-1);
f5=4.1495*(0.7986-lambertw(2.4534e-007*exp((330.7*x1+354.3091)/443.6719)))-x1/331.0230+1.019e-6*(exp(x1/1.3403)-1)-1.019*10^(-6)*(exp(x5/1.3403)-1);
f=[f1 f2 f3 f4 f5];
[/code]
Solver stopped prematurely.

fsolve stopped because it exceeded the function evaluation limit,
options.MaxFunEvals = 1000 (the selected value).


X =

   18.7895   19.0894   19.0963   19.1094  -46.0868


FVAL =

   -0.0022   -0.0180   -0.0172   -0.0175    2.7252


EXITFLAG =

     0


OUTPUT =

       iterations: 180
        funcCount: 1001
        algorithm: 'trust-region dogleg'
    firstorderopt: 0.0022
          message: [1x143 char]

» 本帖已获得的红花(最新10朵)

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-02-22 19:55:48
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

sunjiahuan

铜虫 (小有名气)

送鲜花一朵
引用回帖:
: Originally posted by dbb627 at 2012-02-22 19:55:48:
错误提示信息是矩阵奇异,
可能初值不太合适
我用自带fsolve解了下
结果不是很好
[/code]
function aa
[X,FVAL,EXITFLAG,OUTPUT] =fsolve(@fun,[18.7783   0.01   18.1315   18.0062  -2],optimset('MaxFun ...

您好,非常感谢你的帮助,您能不能把你的matlab代码发到我的邮箱里么sunjiahuan0370@sina.com?我把你贴出来的代码移到我的matlab里居然没成功。谢谢了。
3楼2012-02-22 20:29:00
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

sunjiahuan

铜虫 (小有名气)

sunjiahuan: 回帖置顶 2012-02-22 20:46:39
不好意思,刚看到I1,I2,I3,I4方程中最后一项的里的x1,x2,x3,x4, 应该为-x1,-x2,-x3,-x4,而x5不变。所以我附件里fun.m的方程组里的也要相应改变,因无法编辑,在此说明一下。比如I1中的最后一项1.019*10^(-6)*(exp(x1/1.3403)-1);应改为1.019*10^(-6)*(exp(-x1/1.3403)-1);
4楼2012-02-22 20:46:34
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 284求调剂 +11 junqihahaha 2026-03-26 12/600 2026-03-27 04:37 by wxiongid
[考研] 材料学硕333求调剂 +7 北道巷 2026-03-24 7/350 2026-03-27 00:30 by wxiongid
[考研] 341求调剂 +7 青柠檬1 2026-03-26 7/350 2026-03-27 00:19 by wxiongid
[考研] 【双一流院校新能源、环境材料,材料加工与模拟招收大量调剂】 +4 Higraduate 2026-03-22 8/400 2026-03-26 20:34 by Higraduate
[考研] 一志愿北京化工大学材料与化工 264分各科过A区国家线 +6 哈哈157349 2026-03-21 6/300 2026-03-26 10:39 by 醉在风里
[考研] 085600 材料与化工 329分求调剂 +9 Mr. Z 2026-03-25 9/450 2026-03-26 10:36 by baoball
[考研] 机械学硕总分317求调剂!!!! +4 Acaciad 2026-03-25 4/200 2026-03-25 19:59 by hanserlol
[考研] 321求调剂 +3 璞玉~~ 2026-03-25 3/150 2026-03-25 19:07 by Zhanglab-TJU
[考研] 347求调剂 +4 L when 2026-03-25 4/200 2026-03-25 13:37 by cocolv
[考研] 求调剂323材料与化工 +4 1124361 2026-03-24 4/200 2026-03-25 11:19 by shulmg
[考研] 上海电力大学材料防护与新材料重点实验室招收调剂研究生(材料、化学、电化学,环境) +4 我爱学电池 2026-03-23 4/200 2026-03-25 00:59 by 1027_324
[考研] 311求调剂 +3 冬十三 2026-03-24 3/150 2026-03-24 21:31 by peike
[考研] 求调剂 +6 研研,接电话 2026-03-24 7/350 2026-03-24 17:01 by barlinike
[考研] 276求调剂。有半年电池和半年高分子实习经历 +9 材料学257求调剂 2026-03-23 10/500 2026-03-24 07:36 by wangy0907
[考研] 环境学硕288求调剂 +8 皮皮皮123456 2026-03-22 8/400 2026-03-23 23:47 by 热情沙漠
[考研] 284求调剂 +3 yanzhixue111 2026-03-23 6/300 2026-03-23 22:58 by pswait
[考研] 一志愿重庆大学085700资源与环境,总分308求调剂 +7 墨墨漠 2026-03-23 8/400 2026-03-23 20:36 by Creta
[考研] 298求调剂一志愿211 +3 上岸6666@ 2026-03-20 3/150 2026-03-22 15:50 by ColorlessPI
[考研] 一志愿东华大学控制学硕320求调剂 +3 Grand777 2026-03-21 3/150 2026-03-21 19:23 by 简之-
[考研] 一志愿西安交通大学 学硕 354求调剂211或者双一流 +3 我想要读研究生 2026-03-20 3/150 2026-03-20 20:13 by JourneyLucky
信息提示
请填处理意见