MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [求助]nlinfit问题,求助 (https://www.labfans.com/bbs/showthread.php?t=2766)

hsmyy 2008-05-01 21:41

[求助]nlinfit问题,求助
 
我的程序如下:
wcdma = [1000,1626,3300,4000,5000,6100,12700,16000,23400];
wx = [4.75,5,5.75,6,6.16,6.5,7.5,7.92,8.4];

myfun = inline('A(2) / (1 + (A(2) / A(1) -1)* exp(A(3) * t ))','t','A');

A = nlinfit(wx,wcdma,myfun,[ 0 ,0 ,0 ]);

a = A(1);

b = A(2);

c = A(3);


错误为:

??? Error using ==> nlinfit at 114
The inline model function generated the following error:
Error using ==> inlineeval at 15
Error in inline expression ==> A(2) / (1 + (A(2) / A(1) -1)* exp(A(3)
* t ))
??? Error using ==> mrdivide
Matrix dimensions must agree.

Error in ==> r6 at 6
A = nlinfit(wx,wcdma,myfun,[ 0 ,0 ,0 ]);

但我不知道错误的原因……求教啊!

yinjiangming 2008-05-04 15:15

还没有找到正确解
但是提出两点错误:
函数格式错误:
应该写成
myfun = inline('A(2) ./ (1 + (A(2) ./ A(1) -1)* exp(A(3) * t ))','A','t');
拟核是处置肯定不能为零 否则除数为零了

不知道初值该怎么设 不同的设定结果差别很大 设定已有的大概范围的初值有很大意义

yinjiangming 2008-05-04 15:29

[a b c]=solve('1000=b/(1+(b/a-1)*exp(c*4.75))','1626=b/(1+(b/a-1)*exp(c*5.5))','3300=b/(1+(b/a-1)*exp(c*6.6))')
先这样求出大概解为
a=45
b=149732
c=-0.6538
然后以这个为初值进行计算

slgu 2008-05-10 06:04

该组数据可用最简单的指数曲线wc=a*exp(b*wx)所描述。
SSwc = 4.6344e+008
[a b]=[52.9142739, .724979725]
RSS =1317774.175
RMSe = 2.6355e+005
R^2 = .997157

bluemagic 2008-05-10 11:29

也来学习一下!:lol:


所有时间均为北京时间。现在的时间是 12:23

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.