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
是不是数据不够好,拟合的有些不好? 展开
>> 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
是不是数据不够好,拟合的有些不好? 展开
2个回答
展开全部
补充回答:数据不好
建立函数文件:
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
建立函数文件:
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
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
Sievers分析仪
2024-10-13 广告
2024-10-13 广告
是的。传统上,对于符合要求的内毒素检测,最终用户必须从标准内毒素库存瓶中构建至少一式两份三点标准曲线;必须有重复的阴性控制;每个样品和PPC必须一式两份。有了Sievers Eclipse内毒素检测仪,这些步骤可以通过使用预嵌入的内毒素标准...
点击进入详情页
本回答由Sievers分析仪提供
展开全部
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)
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
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询