Curve fitting problems regarding complex values - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# Curve fitting problems regarding complex values

Posts: 3Member
Hi all, I got a question for you. It is about how to curve fitting and what values are the best in my case. The following is part of my codes. I am using lsqcurvefit, which can not deal with complex values.

Thus, I have to convert complex values to real, but the problem is which method is the best. (1) only the real part of complex values is considered and handled, the imaginary part is ignored. (2) instead of using real, we could choose to use absolute values.

Another question is if we give different initial values for these coefficients, we will get different best values for them. But which ones are the best? It depends on what conditions.

x0=[1.3E-03; 0.2; 5.4; 1]
[x,resnorm] = lsqcurvefit(@myfun,x0,xdata,ydata)
function F = myfun(x,xdata)
F =x(1)*(1-exp(-real(power(((xdata-x(2))/x(3)),x(4)))))
end

• Posts: 3Member
Can anyone remove one of my 2 posts? I have no idea what happended to the website and somehow my post was published twice. Thanks a lot.