Fitting exponential function, coefficients and errors
42 views (last 30 days)
Show older comments
Omnis on 2 Nov 2013
Answered: Jonathan LeSage on 6 Nov 2013
I have experimental data for exponential distribution a*exp(b*x). I need to find coefficients a, b and their errors. I have used function fit(B,C, 'exp1') and I got some results. I have problem because some data points in my file have higher error rate because of the nature of experiment.
1.) Which algorithm or function in Matlab can give the smallest error ? 2.) How can I use/adopt some function in Matlab to put smaller weight (when I calculate coefficients) on data that drastically differ from exponential function ?
Jonathan LeSage on 6 Nov 2013
You have quite a few options that you might want to check out to improve your exponential fit! As an option within the fit function, you can exclude outlier data points from the your exponential fit. For example, here is how you would find an exponential fit with the 25th and 30th data points removed (assuming these are outlier points):
[expFit,goodness] = fit(xdata,ydata,'exp1','Exclude', [25 30]);
You can also provide a vector of weights to augment your exponential fit. In the following example, the weight vector is used in the fit:
[expFit,goodness] = fit(xdata,ydata,'exp1','Weights',weightVec);
As you mentioned, you could decrease the influence of outliers by weighting them accordingly. Another recommendation would be to explore the curve fitting tool that allows you to graphically fit your data. Use cftool to open the user interface.
Here are some links to additional documentation to help get you started:
More Answers (0)
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!