Hi everybody,
I hope to receive help for my problem: I’m working with Mathematica 9 to fit some experimental data who has to reproduce an Erlang function. This last is implemented in the package, and I followed all the instructions to fit it with “NonlinearModelFit”, but it seems to have some problem.
It follow the code I used:
data = Import[
"/Volumes/Archivio/Documenti/Tesi Magistrale/Delay \
simulator/Analisi Sensibilità/Prova/ErlangFunction.txt", "Table"]
nlm1 = NonlinearModelFit[data, (
E^(-((k x)/d)) (d/k)^-k x^(-1 + k))/(k - 1)!, {{k, 4}, {d, 19} },
x, ConfidenceLevel -> 95/100 , MaxIterations -> 100,
Method -> "LevenbergMarquardt"]
nlm1["BestFit"]
nlm1["BestFitParameters"]
And then the answers:
Out[125]= {{8, 9.22098}, {9, 12.603}, {10, 16.5616}, {11,
20.9952}, {12, 25.7512}, {13, 30.6382}, {14, 35.4415}, {15,
39.9425}, {16, 43.9366}, {17, 47.2498}, {18, 49.7508}, {19,
51.3581}, {20, 52.0423}, {21, 51.823}, {22, 50.763}, {23,
48.9592}, {24, 46.5319}, {25, 43.6152}, {26, 40.3468}, {27,
36.8598}, {28, 33.2766}, {29, 29.7039}, {30, 26.2307}, {31,
22.9267}, {32, 19.8431}, {33, 17.0138}, {34, 14.4576}, {35,
12.1801}, {36, 10.1771}, {37, 8.43647}}
During evaluation of In[125]:= NonlinearModelFit::cvmit: Failed to converge to the requested accuracy or precision within 100 iterations. >>
Out[127]= 5.25537186920*10^-285 E^(-16.1068 x) x^325.684
Out[128]= {k -> 326.684, d -> 20.2824}
There are no chances to fit this function, I tried to change accuracy, the number of iterations, and all the other options of NonlinearmodelFit. Between the various tests I noticed that the problem could be linked to the factorial term (k-1)!, because if I take off this, the situation improves.
My data are created from a real gamma with parameters alpha= k and beta=k/d with numerical value k=20 and d=35.
How can I to to obtain that?
Thank you everybody for the support,
Luca


