6
$\begingroup$

I have the following dataset

Data = {{0, 7.77238*10^-43}, {10, 4.80845*10^-14}, {20, 1.83671*10^-13}, {30, 3.79201*10^-13}, {40, 5.87258*10^-13}, {50,7.47558*10^-13}, {60, 8.14542*10^-13}, {70, 7.90253*10^-13}, {80, 7.1244*10^-13}, {90, 6.1629*10^-13}}

The curve look like this

enter image description here

The plot is generated by joining the points. I want best fit, a continious plot.

$\endgroup$
3

1 Answer 1

7
$\begingroup$

Simple NonlinearModelFit

data = {{0, 7.77238*10^-43}, {10, 4.80845*10^-14}, {20, 
    1.83671*10^-13}, {30, 3.79201*10^-13}, {40, 5.87258*10^-13}, {50, 
    7.47558*10^-13}, {60, 8.14542*10^-13}, {70, 7.90253*10^-13}, {80, 
    7.1244*10^-13}, {90, 6.1629*10^-13}};

model = a x + b x^2 + c x ^3 + d x^4 + e;

nlm = NonlinearModelFit[data, model, {a, b, c, d, e}, x]

Plot[nlm[x], {x, 0, 90}, Epilog -> Point[data], PlotRange -> All]

6.8861328671318974*^-15-7.317406274281032*^-15 x+1.1455851486013915*^-15 x^2-1.8092531662781587*^-17 x^3+7.885912004661972*^-20 x^4

enter image description here

You can also use Interpolation[]

ip = Interpolation[data];
Show[ListPlot[data], Plot[ip[x], {x, 0, 90}]]

enter image description here

If you do use Interpolation, note that the derivative may not be what you want. You can choose the order of Interpolation by using InterpolationOrder->4 within the Interpolation[] function (4 is the default).

Plot[{nlm'[x], ip'[x]}, {x, 0, 90}]

enter image description here

$\endgroup$
2
  • $\begingroup$ Touché. OP didn't really give enough info about what he wanted though. $\endgroup$
    – Feyre
    Commented Aug 10, 2016 at 13:41
  • $\begingroup$ @Feye You're right, without direction from the OP, who knows which is the better approach. $\endgroup$
    – Young
    Commented Aug 10, 2016 at 13:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.