## Matlab

Moderators: None (Apply to moderate this forum)
Number of posts: 2147

This Forum Only

Curve fitting problems regarding complex values Posted by cupidsd on 14 Feb 2012 at 8:09 PM
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
Re: Curve fitting problems regarding complex values Posted by cupidsd on 14 Feb 2012 at 8:12 PM
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.

## Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic