Uncertainty for exponential fitting
10 次查看(过去 30 天)
显示 更早的评论
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,
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File 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!