Re: NonlinearFit
- To: mathgroup at smc.vnet.net
- Subject: [mg42247] Re: NonlinearFit
- From: lamp02 at hotmail.com (Andrew Kang)
- Date: Wed, 25 Jun 2003 01:53:42 -0400 (EDT)
- References: <bd6j0m$ca7$1@smc.vnet.net> <bd8o1p$lo8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Thanks. Unfortunately it dose not work. Could you please give me more advice on following error message? Plot::plnr: ft1 is not a machine-size real number at x = 1.25000003125. Plot::plnr: ft1 is not a machine-size real number at x = 1.2804252436796868. Plot::plnr: ft1 is not a machine-size real number at x = 1.31360659989453. General::stop: Further output of Plot :: plnr will be suppressed during this calculation. Please e-mail me. Regards, Andy gohtk at rocketmail.com (goh tat kean) wrote in message news:<bd8o1p$lo8$1 at smc.vnet.net>... > Dear Andy, > > Give a second thought on your problem, I shouldn't multiply your > function and it's conjugate. > > Just expand the complex function a Exp[I Pi*b/180]/(x - c + I d)^2.5, > ComplexExpand[a Exp[I Pi*b/180]/(x - c + I d)^2.5, > TargetFunctions -> {Re, Im}] > > You will get something like, > a Cos[b Pi/180] Cos[2.5 ArcTan[-c + x, d]]/(d^2 + (x - c)^2)^1.25 + (a > Sin[ > b Pi/180] Sin[2.5ArcTan[-c + x, d]]/(d^2 + (x - c)^2)^1.25) > > Use this function to do a NonlinearFit on your data. > > Rewrite your function, > eq[x_, a_, b_, c_, d_] := Re[a Exp[I Pi*b/180]/(x - c + I d)^2.5] > > Generate some dummy data, > data1 = Table[{x, eq[x, 5, 5, 5, 5]}, {x, 1, 10}] > > Load the NonlinearFit package, > << Statistics`NonlinearFit` > > Start the fitting, > ft1 = NonlinearFit[data1, a Cos[b Pi/180] Cos[2.5 ArcTan[-c + x, > d]]/(d^2 + (x - c)^2)^1.25 + (a Sin[ > b Pi/180] Sin[2.5ArcTan[-c + x, d]]/(d^2 + (x - c)^2)^1.25), > x, {a, b, c, d}, ShowProgress -> True] > > > > > > Regards, > tat kean