필터 지우기
필터 지우기

"Warning: Imaginary parts of complex X and/or Y arguments ignored" in fminserach and optimtool

조회 수: 1 (최근 30일)
Dear all,
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

채택된 답변

Walter Roberson
Walter Roberson 2012년 3월 5일
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.
  댓글 수: 2
Victor
Victor 2012년 3월 5일
Dear all,
Thanks for your comments.
Now it is ok but I found just if I let the Matlab to calculate the numbers, it will give me the errors!
For example instead of writing the final value of log(a/b) with a=0.001 and b=1 I wrote -3 and now also instead of "1-((103-298)/(1723-298)" I wrote 1.136842105
It is so strange for me.
do you have any idea?
Walter Roberson
Walter Roberson 2012년 3월 5일
Beware of log vs log10
See also
http://matlab.wikia.com/wiki/FAQ#Why_is_0.3_-_0.2_-_0.1_.28or_similar.29_not_equal_to_zero.3F

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2012년 3월 5일
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.

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by