Vähimruutude meetod

Lihtsalt 6 punkti polüoomidega

sõlmed = {{1, -0.2}, {2, 0.3}, {3, 1}, {4, 2.5}, {5, 
          2}, {6, 1.3}};

ListPlot[sõlmed]

p1 = Fit[sõlmed, {1, x}, x]

p2 = Fit[sõlmed, {1, x, (x^2)}, x]

p3 = Fit[sõlmed, {1, x, (x^2), (x^3)}, x]

Plot[{p1, p2, p3}, {x, 0, 
        7}, 
PlotStyle -> {RGBColor[0, 1, 0], 
          RGBColor[1, 0, 0], 
          RGBColor[0, 0, 1]}, 
Epilog -> {PointSize[
            0.015], Point /@ sõlmed}]

Siinusfunktsiooni äraarvamine

punktid=Table[{x, N[Sin[x]+Random[Real, {-0.1,  0.1}]]},{x, 0, 10, 0.5}]

ListPlot[punktid]

p3 = Fit[punktid, {1, x, (x^2), (x^3)}, x]

p5 = Fit[punktid, Table[x^i, {i, 0, 5}], x]

p10 = Fit[punktid, Table[x^i, {i, 0, 10}], x]

Plot[{p3, p5, p10}, {x, -0.5, 
        10.5}, 
PlotStyle -> {RGBColor[1, 0, 0], 
          RGBColor[0, 1, 0], 
          RGBColor[0, 0, 1]}, 
Epilog -> {PointSize[
            0.01], Point /@ punktid}]

psin = Fit[punktid, {1, Sin[x]}, x]

Plot[{p5, p10, psin}, {x, -1, 
        11}, 
PlotStyle -> {RGBColor[0, 1, 0], 
          RGBColor[0, 0, 1], 
          RGBColor[1, 0, 1]}, 
Epilog -> {PointSize[
            0.01], Point /@ punktid}]

Eksponentfunktsiooni äraarvamine

andmed = {{0, 1.3}, {1, 0.74}, {2, 0.18}, {3, 0.06}}

ListPlot[andmed]

p3 = Fit[andmed, {1, x, 
(x^2), (x^3)}, x]

p5 = Fit[andmed, Table[x^i, {i, 0, 5}], x]

Plot[{p3, p5}, {x, -0.5, 
        3.5}, 
PlotStyle -> {RGBColor[1, 0, 0], 
          RGBColor[0, 1, 0]}, 
Epilog -> {PointSize[
            0.01], Point /@ andmed}]

Antud on punktid  negatiivse eksponendi pealt, leiame kordajad.

ft = Table[N[3 + 2  Exp[-(x/3)]], {x, 10}]

pilt1 = ListPlot[ft, PlotStyle -> Hue[0]]

funks = Fit[ft, {1, Exp[-(x/3)]}, x]

Fit[ft, {1, Sin[x], Exp[-(x/3)], Exp[-x]}, x]

Chop[%]

ft=Table[N[3+2  Exp[-(x/3)]+Random[Real, {-0.1,  0.1}]],{x, 10}]

Fit[ft, {1, Exp[-(x/3)]}, x]

Fit[ft, {1, Sin[x], Exp[-(x/3)], Exp[-x]}, x]

Chop[%]