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

4 ビュー (過去 30 日間)
Angelavtc
Angelavtc 2022 年 5 月 31 日
コメント済み: Angelavtc 2022 年 5 月 31 日
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 件のコメント
Torsten
Torsten 2022 年 5 月 31 日
What is the error message ?
Angelavtc
Angelavtc 2022 年 5 月 31 日
oh la la, now it seems that thre is nor problem anymore. So strange... anyway, thank you @Torsten

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Curve Fitting Toolbox についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by