Reminder: Always center your x-data before fitting!

There are two problems if mean(xdata)0\mathrm{mean}(x_\mathrm{data}) \neq 0:

The first problem is easy to see in an example: If you have a linear model, and if your data lies far off to the right, then the fitted y-intercept is very sensitive to the fitted slope. In other words: Your fit-parameters are highly correlated.

The latter only happens if you have "big" x-offsets or x-scatter in your data. The problem is that the matrices that need to be solved to find the best fit are "ill-conditioned", that is they become sensitive to numerical errors.

This can happen surprisingly early, as seen in the following three plots with x-offsets of 0, 100, and 10000, respectively:

fit1 fit2 fit3

The moderate offset of 1000 (middle plot) obviously poses no problem, but the big offset makes the fit unusable.

If you compute the linear fit via the "basic fitting" dialog, Matlab will warn you about the "ill-conditioned matrix" problem, but if you compute the fit programmatically, there is no such warning!

Bottom line: Always subtract mean(x) before fitting!