Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4702

FindFit on only real parameters

From matyigtm <matyigtm@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject FindFit on only real parameters
Date 2011-09-02 07:29 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j3q0ks$6dk$1@smc.vnet.net> (permalink)

Show all headers | View raw


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

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

FindFit on only real parameters matyigtm <matyigtm@gmail.com> - 2011-09-02 07:29 +0000

csiph-web