matlab中nlinfit非线性拟合求参数

x1=[0.42920.42690.3810.40150.41170.3017];>>x2=[0.000140.000590.01260.00610.004250.044... x1=[0.4292 0.4269 0.381 0.4015 0.4117 0.3017];
>> x2=[0.00014 0.00059 0.0126 0.0061 0.00425 0.0443];
>> y=[0.517 0.509 0.44 0.466 0.479 0.309];
>> myfunc=inline('2.350176*beta(1)*(1-1/beta(2))*(1-(1-x1^(1/beta(2)))^beta(2))^2*(x1^(-1/beta(2))-1)^(-beta(2))*x1^(-1/beta(2)-0.5)*x2','beta','x1','x2');
>> beta=nlinfit(x1,x2,y,myfunc,[8 0.5]);

y是函数;x1,x2是自变量;要求beta(1)和beta(2),哪里不对?

出错信息
??? Error using ==> statset
Expected argument 2 to be a parameter name string or an options structure
created with STATSET.

Error in ==> nlinfit at 91
options = statset(statset('nlinfit'), options);
beta=nlinfit(x,y,@myfun,[8 0.5])
我怎么把这句改为beta=nlinfit(x,y,@myfun,[8;0.5])才能运行出结果?我不太懂啊。。。还有,它上面有些警告。Warning: Rank deficient, rank = 1, tol = 5.7039e-013.
> In nlinfit at 192
Warning: The Jacobian at the solution is ill-conditioned, and some
model parameters may not be estimated well (they are not identifiable).
Use caution in making predictions.
> In nlinfit at 272

beta =

1.0e+010 *

-5.6511
0.0000
是不是数据不够好,拟合的有些不好?
展开
 我来答
袁怡圃
2009-05-06 · TA获得超过950个赞
知道小有建树答主
回答量:184
采纳率:0%
帮助的人:0
展开全部
补充回答:数据不好
建立函数文件:
function y = myfun(beta,x)
y = 2.350176*beta(1)*(1-1/beta(2))*(1-(1-x(:,1).^(1/beta(2))).^beta(2)).^2.*(x(:,1).^(-1/beta(2))-1).^(-beta(2)).*x(:,1).^(-1/beta(2)-0.5).*x(:,2);

运行代码:
x=[0.4292 0.4269 0.381 0.4015 0.4117 0.3017; 0.00014 0.00059 0.0126 0.0061 0.00425 0.0443];
x = x';
y=[0.517 0.509 0.44 0.466 0.479 0.309];
y = y';
beta=nlinfit(x,y,@myfun,[8 0.5])

运行结果:
beta =
-55262931764.9336 0.0517
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
okhz
2009-05-04 · TA获得超过1994个赞
知道小有建树答主
回答量:897
采纳率:0%
帮助的人:946万
展开全部
clear all;
x1=[0.4292 0.4269 0.381 0.4015 0.4117 0.3017]';
x2=[0.00014 0.00059 0.0126 0.0061 0.00425 0.0443]';
x=[x1 x2];
y=[0.517 0.509 0.44 0.466 0.479 0.309]';
f=@(p,x) 2.350176*p(1)*(1-1/p(2))*(1-(1-x(:,1).^(1/p(2))).^p(2)).^2.*(x(:,1).^(-1/p(2))-1).^(-p(2)).*x(:,1).^(-1/p(2)-0.5).*x(:,2);
p0=[8 0.5]';
opt=optimset('TolFun',1e-3,'TolX',1e-3);
[p R]=nlinfit(x,y,f,p0,opt)

参考资料: http://hi.baidu.com/okhz/blog/item/9b360600461f5519738b65d6.html

已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式