MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

FindFit on only real parameters

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121170] FindFit on only real parameters
  • From: matyigtm <matyigtm at gmail.com>
  • Date: Fri, 2 Sep 2011 03:28:53 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

Hello,

Suppose I have data with complex values on which I want to fit a
(nonlinear) curve with _only_ real parameters. How do I find these
parameters?

For example (for demonstration a linear problem is presented)

x={0,1,2}
f={0+I 0,1+I 2,2+I 1}
model:=(a+I b)+c X + d I X^2
FindFit[{x,f}//Transpose,model,{a,b,c,d},X]

returns complex valued "a","b","c" and "d" parameters.
How should I do to obtain only real valued parameters.

I've tried to force the equation to run only with real values. The
results were errors each time:
model := (Re[a] + I Re[b]) + Re[c] X + Re[d] I X^2
or
model := (a Conjugate[a] + I b Conjugate[b]) + c Conjugate[c] X +
  d Conjugate[d] I X^2

Finally I have written a custom ("brute force") function which takes
too much computation time to give results:

findFitReal[data_, expr_, pars_, vars_] :=
 Module[{v},
  v = Table[
     expr, {vars, (data\[Transpose])[[1]]}] - (data\[Transpose])[[
     2]]; NMinimize[ (v.v\[Conjugate]) // Re, pars]]

I cannot change to algorithm of the nonlinear fitting found on
mathworld.wolfram.com/NonlinearLeastSquaresFitting.html to give only
real value for the parameters.

Any hints appreciated,
Matyas





  • Prev by Date: Is Export limitated by screen resolution?
  • Next by Date: Output complex numbers in polar (exponential) form?
  • Previous by thread: Is Export limitated by screen resolution?
  • Next by thread: Output complex numbers in polar (exponential) form?