Curve fitting nonlinear data sets by tuning multiple parameters
1 次查看(过去 30 天)
显示 更早的评论
Hi, I have multiple data sets (rn 5 sets but may increase later). I need to find out the values of three parameters C, a and b in order to best fit these three data sets. The function is as follows:
z=C*x^a*y^b
The datasets I got is as such, each data set has a given y. And once i change x, z changes. How do I tune C,a and b?
Thanks.
2 个评论
采纳的回答
Matt J
2021-8-7
编辑:Matt J
2021-8-7
You can get an initial guess using log-linear fitting,
n=[numel(x1),numel(x2),numel(x3)]; %concatenate data
X=[x1(:);x2(:);x3(:)];
Y=repelem([y1;y2;y3],n);
Z=[z1(:);z2(:),z3(:)];
p=[X.^0,log(X),log(Y)]\log(z); %linear algebraic solution
C0=exp(p(1)); %Initial estimates
a0=p(2);
b0=p(3);
[ab,C]=fminspleas({@(ab,Q) prod(Q.^ab,2)} ,[a0,b0], [X,Y],Z );
a=ab(1);
b=ab(2);
2 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!