Uncertainty for exponential fitting

10 views (last 30 days)
Naznain Saburouhvahid
Naznain Saburouhvahid on 6 May 2022
Edited: Leepakshi on 27 Feb 2025
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 Comments
Naznain Saburouhvahid
Naznain Saburouhvahid on 6 May 2022
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.

Sign in to comment.

Answers (1)

Leepakshi
Leepakshi on 25 Feb 2025
Edited: Leepakshi on 27 Feb 2025
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

Categories

Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!