curvefitting of complex number
조회 수: 1 (최근 30일)
이전 댓글 표시
I get following error when i use Lsqcurvefit
Warning: Imaginary parts of complex X and/or Y arguments ignored.
> In myfun (line 11).
I want both real and imaginary parts
댓글 수: 1
채택된 답변
Harshit Gupta
2022년 11월 15일
Hi Supreeth,
As per my understanding, you are getting the following warning:
Warning: Imaginary parts of complex X and/or Y arguments ignored.
And you want both real and imaginary parts to be included in your plot, while using "lsqcurvefit".
Please refer below to resolve your query:
- "lsqcurvefit" can solve complex-valued problems directly. Note that bound constraints do not make sense for complex values. For a complex problem with bound constraints, split the variables into real and imaginary parts. See Fit a Model to Complex-Valued Data.
- If you want to plot the real part of a vector versus the complex part, pass the vector as a single complex vector to the "plot" function.
- If you want to plot the magnitude of the elements, use the “abs” function on the vector before passing it to the “plot” function.
- Please refer to the following link for more information on the “abs” function: https://www.mathworks.com/help/matlab/ref/abs.html
- Please refer to the following link for more information on the “plot” function: https://www.mathworks.com/help/matlab/ref/plot.html
- You can refer to the following MATLAB Answers link for more information about this warning: https://www.mathworks.com/matlabcentral/answers/96197-why-do-i-get-warning-messages-about-imaginary-parts-of-complex-x-and-or-y-arguments-ignored
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!