x = [0;7.8438;15.6493;23.4767;31.2822;39.0986;46.9123];y = [1;0.8990;0.7102;0.5747;0.4717;0.3766;0.2956];p = polyfit(x,y,5); % coefficient-set p in polynominal function f(x) = p(6)*x^5 + p(5)*x^4 + ... + p(1)
y_hat = polyval(p,x);
Here y_hat(1) is 1.0001, i.e. f(0) = 1.0001
I would like to fit a 5deg polynominal to y,x subject to the constraint that f(0) = 1 exactly.
I suspect its a case for fmincon, any other ideas? (I don't want to use splines)
Best Answer