3
$\begingroup$

I am trying to fit a complex data with a complex function, with the real fitting parameters. I was trying to put there constraints like this, but I got error:

FindFit[data,{1-a/(b-x^2-I*c*x),{Element[{a,b,c},Reals]}},{a,b,c},x]

If I remove constraints, I get in general complex parameters.

$\endgroup$
3
  • $\begingroup$ Are you xs complex too? $\endgroup$ Commented Feb 26, 2015 at 15:47
  • $\begingroup$ No, they are real. $\endgroup$
    – infinity
    Commented Feb 26, 2015 at 17:11
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ Commented Feb 26, 2015 at 17:28

1 Answer 1

2
$\begingroup$

The following works quite well:

k = 1 - a/(b - x^2 - I*c*x);
t = Table[{x, k /. {a -> 10, b -> 5, c -> 2}}, {x, 1, 50}];
FindFit[t, {k, (a | b | c) ∈ Reals}, {a, b, c}, x, NormFunction -> (Norm@## &)]

(* {a -> 9.99976, b -> 4.99994, c -> 1.99994} *)
$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.