I have a data set in such a manner
{x,y}= {
{10^-6,10^-15},
{10^-5,10^-14},
{10^-4,10^-14},
{10^-3,10^-13},
{10^-2,10^-11},
{10^-1,10^-9},
{1,10^-8}
}
I want to fit a polynomial for these data sets.
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityI have a data set in such a manner
{x,y}= {
{10^-6,10^-15},
{10^-5,10^-14},
{10^-4,10^-14},
{10^-3,10^-13},
{10^-2,10^-11},
{10^-1,10^-9},
{1,10^-8}
}
I want to fit a polynomial for these data sets.
xy = {{10^-6, 10^-15}, {10^-5, 10^-14}, {10^-4, 10^-14}, {10^-3,
10^-13}, {10^-2, 10^-11}, {10^-1, 10^-9}, {1, 10^-8}};
Interpolation
ClearAll[intf]
intf = Interpolation[xy, InterpolationOrder -> 3];
Plot[intf[t], {t, 0, 1}]
Fit
ClearAll[fitf]
fitf[x_] := Evaluate@Fit[xy, {1, x, x^2, x^3}, {x}]
Plot[fitf[x], {x, 0, 1}]
xy = {{10^-6, 10^-15}, {10^-5, 10^-14}, {10^-4, 10^-14},
{10^-3, 10^-13}, {10^-2, 10^-11}, {10^-1, 10^-9}, {1, 10^-8}};
{x, y} = Transpose[xy];
X = Transpose[{x^3, x^2, x^1, x^0}];
{a, b, c, d} = Inverse[Transpose[X].X].Transpose[X].y;
{from, to} = x[[{1, -1}]];
Show[ListPlot[xy, PlotMarkers -> {Automatic, Medium}],
Plot[a x^3 + b x^2 + c x + d, {x, from, to}],
PlotRange -> All]