Re: Fitting with a complex equation

*To*: mathgroup at smc.vnet.net*Subject*: [mg18713] Re: Fitting with a complex equation*From*: Lawrence Walker <lwalker701 at earthlink.net>*Date*: Sat, 17 Jul 1999 02:36:35 -0400*Organization*: Morgan State University: COMSARE*References*: <7luhrb$kdk@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hi Gibum, You might want to weight the points and/or window off a portion of the data you want fitted very well. You could weight the points at this point -- Apply[(model[A,wa,Ga,k,t,#1]-#2)^2 &, data,{1}]. Alternatively, the package Statistics`NonlinearFit` has the desired Weights option. data={{x1,f1},{x2,f2},...}; f=Abs[A/(wa-x-I Ga)+k E^(I t)]^2; NonlinearFit[data, Evaluate[f], {x}, {{A,8.1,8.5},{wa,2958,2962},{Ga,8.2,8.6},{k,0.3,0.4},{t,32,35}}, Weights->{1,1,.9,.8,...}]; Lawrence Gibum Kim wrote: > > Hi, there. > I'm having a trouble with the determining parameters of the equation with > the experimental data. > This is my equation. > > f(x)=Abs[A/(wa-x-I Ga)+k E^(I t)]^2 > > A,wa,Ga,k and t are parameters I want to find. > I know the best guess of the parameters. > Even with the best guess values, I got totally wrong values of them using > "FindMinimum". > Here's the program I got from mathematica support. > > ClearAll[A,wa,Ga,k,t] > data=ReadList ["onepeak.dat", Number, RecordLists-> True] > f=Abs[A/(wa + x - I Ga) + k E^(I t)]^2 > <<Statistics` > model[A_?NumberQ,wa_?NumberQ,Ga_?NumberQ, > k_?NumberQ,t_?NumberQ,x_?NumberQ]:= > Abs[A/(wa + x - I Ga) + k E^(I t)]^2 > sse[A_,wa_,Ga_,k_,t_]= > Plus @@ Apply[(model[A,wa,Ga,k,t,#1]-#2)^2 &, data,{1}]; > FindMinimum[sse[A,wa,Ga,k,t], > {A,8.1,8.5},{wa,2958,2962},{Ga,8.2,8.6}, > {k,0.3,0.4},{t,32,35},MaxIterations->500] > > Do you have any idea? > Your any suggestion would be grateful. -- ------------------------------------------------------------ (\___/) The fear of the LORD is the beginning of (o\ /o) wisdom: a good understanding have all they /|:.V.:|\ that do his commandments: his praise \\:::::// endureth for ever. Psa 111:10 -----`"" ""`------------------------------------------------ Lawrence A. Walker Jr., M.Eng./Ph.D. Candidate Morgan State University Clarence M. Mitchell School of Engineering COMSARE (Center Of Microwave/Satellite And RF Engineering) Rm: 306-Schafer Phone: (443)885-1453 ------------------------------------------------------------