Re: Fitting to complex values
- To: mathgroup at smc.vnet.net
- Subject: [mg30801] Re: Fitting to complex values
- From: "Lawrence A. Walker Jr." <lwalker701_remove_ at earthlink.net>
- Date: Wed, 19 Sep 2001 00:16:41 -0400 (EDT)
- References: <9nalpb$npj$1@smc.vnet.net> <9ncgqf$q1g$1@smc.vnet.net> <9nf6i0$sfj$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Kevin, Both NonlinearFit and Fit functions perform the least squares fit. I found that both can be used on complex data directly. Its just that Fit does it with basis functions that are linear combinations and NonLinearFit does it with a function you pick. The method I proposed is one of perhaps many. I chose this method because I felt it offered the flexibility in that the real part and imag part may very well have distinct behaviors which is conducive for two distinct functions or models. On a side note however, I kept getting the following error when I tried to use NonlinearFit on the complex data directly: "Less::nord: Invalid comparison with ... attempted." Yet, Mathematica returned an 'exceptable' solution. Should I disregard the error message? Thanks, Lawrence Kevin J. McCann wrote: > What about just doing a least squares fit? I have done this for complex data > and it works fine. > > Kevin > > "Lawrence A. Walker Jr." wrote: >>Hi Max, >> >>Try dividing the complex data into two data sets: real and imaginary. >>Then you can apply the NonlinearFit function twice. >> >>For example >> >>data = {{1, 1+2 I},{2, 3+4 I}, {3, 4+5 I}}; >>dataRe=Map[{#[[1]],Re[#[[2]]]}&,data]; >>dataIm=Map[{#[[1]],Im[#[[2]]]}&,data]; >> >>NonlinearFit[dataRe, func1, ...]; >>NonlinearFit[dataIm, func2, ...]; >> >>Note, you must specify the functions apriori. >> >>Lawrence >> >> >>Max Ulbrich wrote: >> >> >>>Hi, >>> >>>I have complex data (re+im) from a lock-in amplifier and want to fit >>>them >>>to a complex function. Though, the NonlinearFit function doesn't work >>>with complex data. Has anyone a solution? >>> >>>Max >>>