Exponential fitting for multiple curves forcing the curves to pass through one point (xo,yo)
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with Curve Fitting Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!