Fitting question

*To*: mathgroup at smc.vnet.net*Subject*: [mg51585] Fitting question*From*: János <janos.lobb at yale.edu>*Date*: Sat, 23 Oct 2004 00:22:57 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

I have two lists. One of them contains the running total of some quantity per cycles, the other contains the totals per cycles. Here they are: In[35]:= runtotpergen = {1, 23, 136, 568, 1735, 4382, 9099, 16384, 25993, 36694, 47752, 58044, 66761, 73534, 78429, 81753, 83750, 84873, 85482, 85779, 85937, 86025, 86069, 86081, 86087} In[36]:= totpergen = {1, 22, 113, 432, 1167, 2647, 4717, 7285, 9609, 10701, 11058, 10292, 8717, 6773, 4895, 3324, 1997, 1123, 609, 297, 158, 88, 44, 12, 6} I am trying to find out the analytical form of a function which fits best totpergen. Looking the ListPlot of runtotpergen, it looks similar to the sigmoid function, so I define: In[37]:= sg[x_] := 1/(1 + E^(-x)) and In[38]:= dsg = Derivative[1][sg] The best I could come out with manual try was: In[40]:= dsgfit = Fit[totpergen, {dsg[0.48*(x - 11)]}, x] Out[40]= 44143.063409020484/ (E^(0.48*(-11 + x))* (1 + E^(-0.48*(-11 + x)))^ 2) When I create the plots of the data totpergen and the above Fit dsgfit as: In[41]:= lsp = ListPlot[totpergen, PlotRange -> All] In[42]:= psp = Plot[dsgfit, {x, 1, 25}] and plot them together, they overlap to some degree, but not to my satisfaction. In[43]:= Show[lsp, psp] totpergen is not symmetrical, so I tried different multiplications of x^n and dsg without any success. I also tried the polynomials of dsg like: In[83]:= polydsgfit = Fit[totpergen, {1, dsg[x - 11], dsg[x - 11]^2, dsg[x - 11]^3, dsg[x - 11]^4}, x] but it just looks funny. I also tried: In[92]:= paramdsgfit = FindFit[ totpergen, a*dsg[b*x - c] + d, {a, b, c, d}, x] Out[92]= {a -> -2250.9485483974095, b -> -14745.171180125675, c -> 111324.17194273268, d -> 3443.48} but it gave me just a horizontal line when I plotted it. In[101]:= ip = InterpolatingPolynomial[ totpergen, x] does not help either. I feel that Mathematica has the capability to find the best fitting function without too much manual trials. Any hint how to do that ? Thanks ahead. János ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice)