Re: NonlinearFit
- To: mathgroup at smc.vnet.net
- Subject: [mg42223] Re: NonlinearFit
- From: gohtk at rocketmail.com (goh tat kean)
- Date: Tue, 24 Jun 2003 01:27:10 -0400 (EDT)
- References: <bd6j0m$ca7$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
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