Uncertainty for exponential fitting

조회 수: 15 (최근 30일)
Naznain Saburouhvahid
Naznain Saburouhvahid 2022년 5월 6일
편집: Leepakshi 2025년 2월 27일
Hello,
I am using Curve Fitting Toolbox in MatLab, to fit single and double expoenential decays. (I've used cftool)
In this toolbox, the confidence interval is calculated for both the exponential coefficient and time. However, I do not know how to calculate uncertainty for exponential distribution? I need to report the time with uncertainty like this : t= 2.3 ± ...
Would it be possible for someone to answer my question. Your help is really needed.
Thank you in advance,
  댓글 수: 2
Matt J
Matt J 2022년 5월 6일
What is t?
Naznain Saburouhvahid
Naznain Saburouhvahid 2022년 5월 6일
In an exponential equation like below we have:
I(t) = I(0) exp(-x/t)
which I(0) and t are the coefficients. Now I want to calculate the uncertainty for t.

댓글을 달려면 로그인하십시오.

답변 (1개)

Leepakshi
Leepakshi 2025년 2월 25일
편집: Leepakshi 2025년 2월 27일
Hi Naznain,
To report the time constant with uncertainty from your curve fitting results in MATLAB's Curve Fitting Toolbox, you can follow these steps:
1. Fit the Model: Use “cftool” to fit your data with a single or double exponential decay model. Ensure that you select the appropriate model equation, such as:
- Single exponential: f(t)=a⋅e^(−t/τ)+c
- Double exponential: f(t)=a1⋅e(−t/τ1)+a2⋅e^(−t/τ2)+c
2. View Fit Results: After fitting, the Curve Fitting Tool will display the fit results, including parameter estimates and their confidence intervals. The confidence interval for the time constant(s) will be shown in the results pane.
3. Extract Parameter Confidence Intervals: To extract the confidence intervals programmatically, you can use the “fit” function in MATLAB. Here's a basic example of how you might do this:
% Assuming xData and yData are your data vectors
[fitresult, gof] = fit(xData, yData, 'exp1'); % For single exponential
% or
% [fitresult, gof] = fit(xData, yData, 'exp2'); % For double exponential
% Extract confidence intervals
ci = confint(fitresult, 0.95); % 95% confidence interval
% For single exponential: tau = -1/fitresult.b
tau = -1 / fitresult.b;
tau_lower = -1 / ci(2, 2); % Lower bound
tau_upper = -1 / ci(1, 2); % Upper bound
% Calculate uncertainty
tau_uncertainty = (tau_upper - tau_lower) / 2;
4. Report the Time Constant with Uncertainty: Once you have the time constant and its uncertainty, you can report it in the desired format. For example:
τ = 2.3 ± 0.1 (units)
Replace “2.3” with your calculated “tau”and “0.1” with the calculated “tau_uncertainty”.
5. Consider the Units: Ensure that you are consistent with the units throughout your calculations and reporting.
By following these steps, you should be able to calculate and report the time constant with its associated uncertainty from your exponential decay fits in MATLAB.
Thanks

카테고리

Help CenterFile Exchange에서 Get 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