Fitting a complex Function with FindMinimum
- To: mathgroup at smc.vnet.net
- Subject: [mg65692] Fitting a complex Function with FindMinimum
- From: "petitsun1" <r.bactavatchalou at mx.uni-saarland.de>
- Date: Sun, 16 Apr 2006 01:44:48 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I would like to fit experimental data with a complex function. I have first give the experimental data: {x, real(y),Imag{y}} as following: \!\({{10.24`, 12.611`, 0.1344`}, {20.48`, 12.595`, 0.17804`}, {40.96`, \ 12.557`, 0.29196`}, {81.92`, 12.463`, 0.50528`}, {163.84`, 12.234`, \ 0.83546`}, {327.68`, 11.773`, 1.2298`}, {655.36`, 11.054`, 1.5477`}, {1310.7`, 10.191`, 1.6657`}, {2621.4`, 9.3468`, 1.5783`}, {5242.9`, 8.6333`, \ 1.3658`}, {10486, 8.0744`, 1.1128`}, {20972, 7.6556`, 0.87569`}, {41943, 7.3466`, 0.67967`}, {83886, 7.1146`, 0.53152`}, {167770, 6.9339`, 0.42835`}, {335540, 6.7872`, 0.36402`}, {671090, 6.6575`, 0.3308`}, { 1.3422`*^6, 6.5308`, 0.32231`}, {2.6844`*^6, 6.4072`, 0.33302`}, \ {5.3687`*^6, 6.3103`, 0.37133`}}\) After that, I define the function y=eps and the real and imaginary part of esp : eps[Eu1_, Es1_, tau1_, alpha1_, tau1_, fr_] := Eu1 + (Es1 - Eu1)/(1 + (I*2*p* fr*tau1)^alpha1)^beta1 f[Eu1_, Es1_, tau1_, alpha1_, tau1_, fr_] := Re[eps[Eu1, Es1, tau1, alpha1, tau1, fr]] g[Eu1_, Es1_, tau1_, alpha1_, tau1_, fr_] := -Im[eps[Eu1, Es1, tau1, alpha1, tau1, fr]] I define a new function that I would like to minimize (least squares fit): << Statistics` ssq[Eu1_, Es1_, tau1_, alpha1_, tau1_] = Plus @@ Apply[((f[Eu1, Es1, tau1, alpha1, tau1, #[[ 1]]] - #[[2]])^2 + (g[Eu1, Es1, tau1, alpha1, tau1, #[[ 1]]] - #[[3]])^2) &, t1] He gives me the error: Set write:Tg plus in (...) is protected Now, I would like to fit with minimizing the function as: FindMinimum[ssq[Eu1, Es1, tau1, alpha1, tau1], {Eu1, 6, 7}, { Es1, 12, 13}, {tau1, 0.0001, 0.001}, {alpha1, 0, 1}, {beta1, 0, 1}] Buet he can´t ... Have someone one Idee?? Thank you, Ravi