I am running into an error when I try to perform a weighted poly 1 fit. The weights I am using are the inverse of the errors on the data points squared (1/error^2). The commands I am using are:
options=fitoptions('Weights',1/(toterr(good)).^2); [p,goodness_linear] = fit(opttime(good),x(good),'poly1',options);
I end up getting the error that is quoted in the question title. I originally, incorrectly, had the weights set as
options=fitoptions('Weights',(toterr(good)));
That did not throw an error. I should say that all of the errors on the data points have the same magnitude of 0.8492 (i.e. all the values in toterr are 0.8492), which makes me wonder if I even really need to do a weighted fit. But still, if I could get the fit to work with the weights of 1/(toterr^2) that would be ideal.
Best Answer