24小时热门版块排行榜    

查看: 1445  |  回复: 5

mm_bar2001

木虫 (小有名气)

[求助] matlab程序运行出现警告,求指点修改

源程序如下
function f= ENRTL(beta)
x2 = [0.0056,0.0099,0.0160,0.0235,0.0326,0.0415,0.0496,0.0580,0.0664,0.747,0.0806,0.0892,0.0968,0.1044,0.1115,0.1216,0.1263,0.1295,0.1324,0.1391,0.1448];
x1 = 1 - x2;
y1exp = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
T = [369.9,369.95,370.05,370.15,370.35,370.45,370.65,370.80,370.95,371.10,371.25,371.40,371.60,371.80,372.00,372.25,372.40,372.50,372.65,372.75,372.85];
P = 100.00;



for i = 1:21;
    Ps1(i)=exp(16.2886-3816.44/(T(i)-46.13));

   
end

   
  %计算值r  
  for i=1:21;
    t12(i)=beta(1)/8.314/(T(i));
    t21(i)=beta(2)/8.314/(T(i));
    G12(i)=exp(-0.206*t12(i));
    G21(i)=exp(-0.206*t21(i));
    r1cal(i)=exp((G21(i)*t21(i)*4*x2(i))/(G21(i)*4*x2(i)+x1(i))-x1(i)*G21(i)*t21(i)*4*x2(i)/(G21(i)*4*x2(i)+x1(i))+2*x2(i)*G12(i)*t12(i)/(2*x2(i)+x1(i)*G12(i))-2*x2(i)*G12(i)*x1(i)*t12(i)*G12(i)/(2*x2(i)+x1(i)*G12(i))+2*x2(i)*G12(i)*t12(i)/(2*x2(i)+x1(i)*G12(i))-2*x2(i)*G12(i)*x1(i)*G12(i)*t12(i)/(2*x2(i)+x1(i)*G12(i)));
    y1cal(i)=r1cal(i)*x1(i)*Ps1(i)/P;

   end
  
    %目标函数
   
sumdetr1=sum((y1exp-y1cal).^2);

f=sumdetr1;


调用命令为[x,output]=lsqnonlin(@ENRTL,[1,1])


然后出现警告,提示我用LM算法,由于初学matlab,不不知道该如何修改算法,

Warning: Trust-region-reflective algorithm requires at least as many equations as variables; using Levenberg-Marquardt algorithm instead.
> In lsqncommon at 77
  In lsqnonlin at 237

Solver stopped prematurely.

lsqnonlin stopped because it exceeded the function evaluation limit,
options.MaxFunEvals = 400 (the default value).
回复此楼

» 猜你喜欢

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

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

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
zhangguangping: 金币+2, 谢谢指教! 2012-03-29 16:07:39
mm_bar2001: 金币+10, 有帮助, 能不能把调用命令写出来,剩下的金币就给你了 2012-03-29 19:58:28
CODE:
function aa

options = optimset('Algorithm','Levenberg-Marquardt','MaxFunEvals',5000);
[x,RESNORM,RESIDUAL,EXITFLAG]=lsqnonlin(@ENRTL,[1,1],[],[],options)
function f= ENRTL(beta)
x2 = [0.0056,0.0099,0.0160,0.0235,0.0326,0.0415,0.0496,0.0580,0.0664,0.747,0.0806,0.0892,0.0968,0.1044,0.1115,0.1216,0.1263,0.1295,0.1324,0.1391,0.1448];
x1 = 1 - x2;
y1exp = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1];
T = [369.9,369.95,370.05,370.15,370.35,370.45,370.65,370.80,370.95,371.10,371.25,371.40,371.60,371.80,372.00,372.25,372.40,372.50,372.65,372.75,372.85];
P = 100.00;



for i = 1:21;
    Ps1(i)=exp(16.2886-3816.44/(T(i)-46.13));

   
end

   
  %计算值r  
  for i=1:21;
    t12(i)=beta(1)/8.314/(T(i));
    t21(i)=beta(2)/8.314/(T(i));
    G12(i)=exp(-0.206*t12(i));
    G21(i)=exp(-0.206*t21(i));
    r1cal(i)=exp((G21(i)*t21(i)*4*x2(i))/(G21(i)*4*x2(i)+x1(i))-x1(i)*G21(i)*t21(i)*4*x2(i)/(G21(i)*4*x2(i)+x1(i))+2*x2(i)*G12(i)*t12(i)/(2*x2(i)+x1(i)*G12(i))-2*x2(i)*G12(i)*x1(i)*t12(i)*G12(i)/(2*x2(i)+x1(i)*G12(i))+2*x2(i)*G12(i)*t12(i)/(2*x2(i)+x1(i)*G12(i))-2*x2(i)*G12(i)*x1(i)*G12(i)*t12(i)/(2*x2(i)+x1(i)*G12(i)));
    y1cal(i)=r1cal(i)*x1(i)*Ps1(i)/P;

   end
  
    %目标函数
   
sumdetr1=sum((y1exp-y1cal).^2);

f=sumdetr1;

Local minimum possible.

lsqnonlin stopped because the final change in the sum of squares relative to
its initial value is less than the default value of the function tolerance.




x =

  1.0e+003 *

    3.9301    0.1197


RESNORM =

    0.0042


RESIDUAL =

    0.0652


EXITFLAG =

     3
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-29 14:39:39
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

mm_bar2001

木虫 (小有名气)

引用回帖:
2楼: Originally posted by dbb627 at 2012-03-29 14:39:39:
function aa

options = optimset('Algorithm','Levenberg-Marquardt','MaxFunEvals',5000);
=lsqnonlin(@ENRTL,,[],[],options)
function f= ENRTL(beta)
x2 = ;
x1 = 1 - x2;
y1exp = ;
T = ;
P = 1 ...

能不能把调用命令也列出来,我刚学matlab!是不是还要用lsqnlonlin来调用?
3楼2012-03-29 19:59:44
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

dbb627

荣誉版主 (著名写手)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
mm_bar2001: 金币+40, ★★★★★最佳答案 2012-03-29 23:34:40
引用回帖:
3楼: Originally posted by mm_bar2001 at 2012-03-29 19:59:44:
能不能把调用命令也列出来,我刚学matlab!是不是还要用lsqnlonlin来调用?

这个代码已经调用lsqnlonlin了,你只要将所用代码拷到editor中保存后点击run就可以了
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-29 20:29:11
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

chaiqing123

金虫 (小有名气)

你这是含电解质的两元NRTL参数回归吧?有没有试着 做三元回归的?
可不可以跟你交流下?我现在做含电解质三元NRTL回归的程序。
5楼2012-04-05 19:25:47
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

chaiqing123

金虫 (小有名气)

楼主 你的eleNRTL模型能不能 发给我一下 方便加QQ么 408222331.
6楼2012-04-05 19:48:28
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 mm_bar2001 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[硕博家园] 怎么带研究生? +10 豆豆小小2 2024-06-20 10/500 2024-06-20 20:50 by rhhua11111
[论文投稿] ACS AMI 返回审稿意见,一个大修,两个据稿,编辑给的修改重投 +7 智商已更新 2024-06-19 7/350 2024-06-20 19:54 by kinlin13
[博后之家] 在国内某高校做全职博士后2年,现在找到新的单位,出站或退站对新工作有什么影响? +3 nxplfcc 2024-06-20 3/150 2024-06-20 19:50 by zhangysbad
[有机交流] 求助 10+5 脂质纳米粒 2024-06-20 6/300 2024-06-20 17:16 by czyzsu
[找工作] 高校两个offer选择 +15 cowox2021 2024-06-18 16/800 2024-06-20 15:24 by ase123456
[考博] 这个博士要读吗 +15 Sea Breeze 2024-06-16 29/1450 2024-06-20 14:30 by Sea Breeze
[基金申请] F03青年基金函评结果 +3 暨阳一只柴 2024-06-19 4/200 2024-06-20 11:15 by 暨阳一只柴
[基金申请] 工材口青年基金上会可能性 +8 今晚推荐22 2024-06-19 10/500 2024-06-20 11:00 by 手心里的幸福
[基金申请] 太卷了 +14 laoyuefubio 2024-06-17 27/1350 2024-06-20 09:52 by htjwqy
[论文投稿] Scientific Reports二审90天了,催稿也没反应怎么办? +3 智晨君 2024-06-18 6/300 2024-06-19 20:08 by licheng78
[基金申请] 面上博士后 +3 jsqy 2024-06-19 3/150 2024-06-19 17:58 by bxwisdom_886
[访问学者] 国家公派访问学者申请结果出了吗? +4 65syn 2024-06-13 4/200 2024-06-19 16:40 by 海洋之心168
[基金申请] Nature 11日发文,中国著名学者们称造假迫不得已 +8 babu2015 2024-06-14 8/400 2024-06-19 15:25 by 风今25
[高分子] 寻找聚酯反应釜 +3 茕茕恭煮 2024-06-15 6/300 2024-06-18 14:15 by 茕茕恭煮
[高分子] 烧瓶内合成聚酯 +3 大帝国乐 2024-06-17 7/350 2024-06-18 11:10 by 大帝国乐
[论文投稿] 审稿问题:为什么荧光激发波长和紫外吸收波长差的大? 10+5 sdawege 2024-06-14 10/500 2024-06-17 18:54 by HH-探针
[论文投稿] 二审返修送审10天了,原来一审的3个审稿人只有2个接受了审稿,会邀请新审稿人么? 50+3 huanpo116 2024-06-15 5/250 2024-06-16 10:27 by bobvan
[论文投稿] 投稿被一个审稿人恶意评审了怎么样? +5 1chen 2024-06-14 7/350 2024-06-15 23:15 by xy66xy
[论文投稿] 投稿时忘记修改一作 +7 gll123456 2024-06-13 11/550 2024-06-15 11:49 by gll123456
[基金申请] 博后基金,以往的结果点不开,怎么回事呢?最后一次机会了,两次都没中前面。 +7 kyukitu 2024-06-14 13/650 2024-06-15 06:46 by 我是王小帅
信息提示
请填处理意见