curvefitting of complex number
4 次查看(过去 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
采纳的回答
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!