Exponential fitting for multiple curves forcing the curves to pass through one point (xo,yo)
2 次查看(过去 30 天)
显示 更早的评论
I want to make different curves (existing in an array) fit an exponential function passing through a point (different for each curve).
When I do the fit for a single curve, I have no problem (in fact, I follow the guidelines in this question https://fr.mathworks.com/matlabcentral/answers/424475-how-to-force-a-exponential-fit-to-go-through-a-preestablish-point-x-y). Which means:
ft = fittype('y0*exp(b*(x-x0))','independent','x',...
'problem',{'x0','y0'},'coefficients','b');
x0 = 0;
y0 = 2;
mdl = fit(x,y,ft,'problem',{x0,y0},'StartPoint',0.5);
My problem is when I try to solve the fit for each of the curves in the array x and y. Here is the way I approach the problem:
ft= fittype('y0*exp(b*(x-x0))','independent','x',...
'problem',{'x0','y0'},'coefficients','b');
x0=cell(1,length(x));
y0=cell(1,length(x));
mdl=cell(1,length(x));
for k = 1:length(x)
x0{k}=x_max_1stder_jun_17_s{k}; %Xo points
y0{k}= y_max_1stder_jun_17_s{k}; %Yo points
mdl{k}= fit(x{k},y{k},ft,'problem',{x0{k},y0{k}},'StartPoint',0.5);
end
Any clues as to what I am doing wrong?
Thank you in advance!
回答(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!