Fitting exponential curve in data
古いコメントを表示
I have a txt file with data corresponding to the number of atoms trapped as a function of time. How can I create a function (in a separate file) with
EDecay(t,τ,A,B) = A*exp(-t/τ)+B and then use the function fit to fit the data, using certain starting points? And then how can I deduce the lifetime τ?
回答 (1 件)
load data
funlist={@(tau,t)exp(-t/tau),1};
idx=tdata>0;
[tau,AB]=fminspleas(funlist,1,tdata(idx),ydata(idx));
tau,
A=AB(1),
B=AB(2)
fn=@(t) A*funlist{1}(tau,t)+B;
plot(tdata,ydata,'o', tdata, fn(tdata));
xlabel 't';
ylabel 'EDecay';
ylim([0,2*max(ydata)])
2 件のコメント
Matt J
2021 年 6 月 7 日
Why? If it works, why do more work than is necessary?
カテゴリ
ヘルプ センター および File Exchange で Fit Postprocessing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
