Clear Filters
Clear Filters

How to fit a desired function form to a set of data in MATLAB?

1 view (last 30 days)
Dear All,
I just installed the curve fitting toolbox and have been trying to get familiar with how it works. Although my question is specifically addressing a real problem, it could be a general question with any arbitrary choice of functional form. Assume I have a desired functional form such as :
f(x) = D*(1 - exp(-a*x))^2
And I have the following data set of:
X Y
-0.55 2.3386639
-0.5 -15.554354
-0.45 -31.500773
-0.4 -45.661997
-0.35 -58.182891
-0.3 -69.179367
-0.25 -78.728997
-0.2 -86.859606
-0.15 -93.532515
-0.1 -98.620664
-0.05 -101.89666
0 -103.08067
0.05 -102.01361
0.1 -98.879876
0.15 -94.172935
0.2 -88.344847
0.25 -81.576677
0.3 -73.851215
0.35 -65.088782
0.4 -55.255995
0.45 -44.56707
0.5 -33.717314
0.55 -23.724423
0.6 -15.329395
0.65 -8.7090074
0.7 -3.7387088
0.75 -0.25488612
0.8 1.9270662
0.85 3.0617316
0.9 3.4563882
0.95 3.405915
1 3.1230416
1.05 2.706436
1.1 2.3402943
1.15 2.018794
1.2 1.7367674
1.25 1.4896294
1.3 1.2733121
1.35 1.0842074
1.4 0.91911626
1.45 0.77520246
1.5 0.64995259
I want to know how I can fit the given functional form to the provided set of data and find the coefficients a and D. Even though I know how to use polyfit, and simple exponential fitting in MATLAB, when it comes to complicated functional forms, I stuck in mug!!
I hope by your helps and assistance I will be able to follow a general strategy to fit any arbitrary functional forms to a given set of data. Thank you so much.
  2 Comments
nony lew
nony lew on 13 Apr 2018
Did you solve the problem? I have something similar to do and I do not know how. Thanks,
Unai San Miguel
Unai San Miguel on 16 Oct 2018
Have you looked at the documentation of functions fit and fittype?

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!