MATLAB: Least squares equation fit help

curve fittingleast squares

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

Best Answer

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:
Related Question