# Fitting exponential function, coefficients and errors

조회 수: 14 (최근 30일)
Omnis 2013년 11월 2일
답변: Jonathan LeSage 2013년 11월 6일
Dear experts,
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 ?
Thank you.

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

### 채택된 답변

Jonathan LeSage 2013년 11월 6일
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:

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

### 카테고리

Help CenterFile Exchange에서 Interpolation에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by