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

 Réponse acceptée

the cyclist
the cyclist le 8 Déc 2011

0 votes

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 commentaire

Tim
Tim le 8 Déc 2011
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!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by