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:


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

  • $\begingroup$ Are you xs complex too? $\endgroup$ – Dr. belisarius Feb 26 '15 at 15:47
  • $\begingroup$ No, they are real. $\endgroup$ – infinity Feb 26 '15 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$ – Dr. belisarius Feb 26 '15 at 17:28

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} *)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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