NonlinearFit
- To: mathgroup at smc.vnet.net
- Subject: [mg57671] NonlinearFit
- From: "michael" <john at rsc.anu.edu.au>
- Date: Fri, 3 Jun 2005 05:34:39 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hallo! I get a series of error messages when trying to do the following fitting. Does anyone have an explanation for this? Needs["Statistics`NonlinearFit`"]; dataset = {{1.57, 166796}, {3.13, 136002}, {4.7, 65030}, {6.26, 4521}, {7.83, 4318}, {9.39, 49000}, {10.96, 60576}, {12.52, 17297}, {14.09, -18531}, {15.65, 19586}, {17.22, 113782}, {18.78, 162297}, {20.35, 104847}, {21.91, 21690}, {23.48, 26122}, {25.04, 124402}, {26.61, 230890}, {28.17, 268847}, {29.74, 265542}, {31.3, 286730}, {32.87, 347177}, {34.43, 398782}, {36., 405570}, {37.56, 386662}, {39.13, 378862}, {40.69, 375894}, {42.26, 382073}, {43.82, 421963}, {45.39, 513252}, {46.95, 623846}, {48.52, 690012}, {50.08, 717172}, {51.65, 768446}, {53.21, 909624}, {54.78, 1113780}, {56.34, 1300421}, {57.91, 1468149}, {59.47, 1680055}, {61.04, 1970465}, {62.6, 2367746}, {64.17, 2809895}, {65.73, 3264465}, {67.3, 3692246}, {68.86, 4046681}, {70.43, 4277327}, {71.99, 4360413}, {73.56, 4345338}, {75.12, 4362619}, {76.69, 4547432}, {78.25, 4956316}, {79.82, 5597006}, {81.38, 6424912}, {82.95, 7086361}, {84.51, 7292635}, {86.08, 6797194}, {87.64, 5857715}, {89.21, 4739038}, {90.77, 3744384}, {92.34, 2973363}, {93.9, 2428473}, {95.47, 2062134}, {97.03, 1767899}, {98.6, 1540802}, {100.16, 1377719}, {101.73, 1267488}, {103.29, 1165008}, {104.86, 1017071}, {106.42, 862570}, {107.99, 757954}, {109.55, 720299}, {111.12, 679967}, {112.68, 606439}, {114.25, 518329}, {115.81, 472809}, {117.38, 481415}, {118.94, 496234}, {120.51, 471529}, {122.07, 404742}, {123.64, 343763}, {125.2, 312319}, {126.77, 302469}, {128.33, 294309}, {129.9, 280108}, {131.46, 285452}, {133.03, 323044}, {134.59, 364258}, {136.16, 350050}, {137.72, 291175}, {139.29, 221524}, {140.85, 184576}, {142.42, 178082}, {143.98, 168295}, {145.55, 150666}, {147.11, 144994}, {148.68, 163618}, {150.24, 164462}, {151.81, 126623}, {153.37, 88763}, {154.94, 96576}, {156.5, 130508}} Clear[ny, nyzero, rate]; AL[ny_, nyzero_, rate_] = rate/(rate^2 + 4*Pi^2*(ny - nyzero)^2); DL[ny_, nyzero_, rate_] = 2*Pi*(ny - nyzero)/(rate^2 + 4*Pi^2*(ny - nyzero)^2); tmix = 0.006; Imax = 2.9*10^8; freqzero = 78; J = 16; lambda = 45; eta = 8; reg = NonlinearRegress[dataset, Imax*(AL[freq, freqzero + J/2, lambda - eta]* Exp[-(lambda - eta)*tmix] + AL[freq, freqzero - J/2, lambda + eta]* Exp[-(lambda + eta)*tmix])*Cos[Pi*J*tmix] + Imax*(DL[freq, freqzero + J/2, lambda - eta]* Exp[-(lambda - eta)*tmix] - DL[freq, freqzero - J/2, lambda + eta]* Exp[-(lambda + eta)*tmix])*Sin[Pi*J*tmix], freq, {{Imax, 3*10^8}, {freqzero, 78}, {J, 16}, {lambda, 45}, {eta, 10}}]; u = (BestFitParameters /. reg) Plot[Imax*(AL[freq, freqzero + J/2, lambda - eta]*Exp[-(lambda - eta)*tmix] + AL[freq, freqzero - J/2, lambda + eta]*Exp[-(lambda + eta)*tmix])* Cos[Pi*J*tmix] + Imax*(DL[freq, freqzero + J/2, lambda - eta]*Exp[-(lambda - eta)*tmix] - DL[freq, freqzero - J/2, lambda + eta]* Exp[-(lambda + eta)*tmix])*Sin[Pi*J*tmix], {freq, 0, 154.94}, Prolog -> {RGBColor[1, 0, 0], PointSize[0.02], Point /@ dataset}];