MATLAB: With a given set of X and Y values, how to determine (m+jn) for the equation—Y = (a+jb)X^3+​(c+jd)X^2+​(p+jq)X+(m​+jn). X and Y values are in complex form

curve fittingcurve fitting with complex valuesregressionregression with complex numbers

With a given set of X and Y values, how to determine (m+jn) for the equation: Y = (a+jb)X^3+(c+jd)X^2+(p+jq)X+(m+jn). X and Y values are also in complex form

Best Answer

You can get the values like this
output = [X.^3 X.^2 X.^1 ones(size(X))]\Y
It will return 4 complex numbers. Depending on the number of elements in X and Y, the solution is either unique (if the number of elements in X is equal to 4), one of infinitely many (if the number of elements in X is less than 4) or solution in least square sense (if the number of elements in X is greater than 4).