Exponential fitting for multiple curves forcing the curves to pass through one point (xo,yo)

3 views (last 30 days)
Angelavtc on 31 May 2022
Commented: Angelavtc on 31 May 2022
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',...
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',...
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);
Any clues as to what I am doing wrong?
Thank you in advance!

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by