I am trying to fit a curve to experimental data by use of "optimtool" and "fminsearch".
But I receive a warning which says " Imaginary parts of complex X and/or Y arguments ignored". I have this warning from the first iteration.
Any idea to solve this warning is appreciated. Thanks in advance Best regards Victor
No products are associated with this question.
Turn on FunValCheck to produce an error when imaginary values are encountered.
If your fitting inherently involves imaginary quantities, then please note:
fminsearch only minimizes over the real numbers, that is, x must only consist of real numbers and f(x) must only return real numbers. When x has complex variables, they must be split into real and imaginary parts.
Evaluate your function at the initial values you provide. Is the result complex? If so, that's the reason for the warning. We can't be of much more assistance without seeing reproduction steps.