Effacer les filtres
Effacer les filtres

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

6 vues (au cours des 30 derniers jours)
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!
  2 commentaires
Angelavtc
Angelavtc le 31 Mai 2022
oh la la, now it seems that thre is nor problem anymore. So strange... anyway, thank you @Torsten

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Get Started with Curve Fitting Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by