Least squares equation fit help

Hi I'm trying to find the solutions (a,b,c,d) to the following equation:
y=a+b(x)+c(ln(x-d))
where x and y are known vectors.
I have been trying to use the curve fitting toolbox and writing it as a custom equation but keep getting the following error: "Complex value computed by model function, fitting cannot continue."
Any help would be great, I have a fair bit of Matlab experience but am new to the curve fitting toolbox.
Tim

 Accepted Answer

the cyclist
the cyclist on 8 Dec 2011
I don't have the Curve Fitting Toolbox, but if you also have the Statistics Toolbox, then my answer and example in this question may help you:

1 Comment

Thanks that is a great help (I do also have the stats toolbox). I'm now having some extra little niggles with imaginary numbers (due to having a log of a negative value) and the nlinfit function is also exceeding the iteration limit but will try and sort these.
Many thanks!

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!