- "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
curvefitting of complex number
2 views (last 30 days)
Harshit Gupta on 15 Nov 2022
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: