Automatic method that returns the best combination of the coefficients of the polynomial with the lowest RSS value

4 views (last 30 days)
Hello everyone,
I hope you can help me.
I have a set of measured values (vector x) and estimated values from another parameter y (vector z) of 16 subjects (so 16 vectors of measured values and 16 of estimated values). The estimated data were obtained from a regression model derived from the data set (y vs x). This model has a polynomial form (y=-a x^2+bx-c ) with a, b and c being known. I would like to obtain a better model by minimising the sum of squared residuals (RSS) (sum(x-z)^2) of all subjects by automatically modifying the coefficients of the polynomial model. Is there an automatic method in matlab that returns the best combination of the coefficients of the polynomial that gives me the lowest RSS value?
N.B.
I am not starting from the data to develop the model, I already have a model (y=-a x^2+bx-c ), I would just like to modify the coefficients based on the estimates obtained by using it. I would like to keep the combination of coefficients that minimised the difference between the measured and estimated data.
I hope I have explained myself well.
Thank you in advance for your help!

Answers (1)

Andrew Ouellette
Andrew Ouellette on 11 Nov 2022
Hello,
You can use the "polyfit" function with n=2 to get the parabola of best fit for your data:
However, if you have already used your measured data to fit a regression model, you will not be able to use your regression to further improve your estimates- you can think of this as not violating the "No free lunch" theorem. If your previous regression was done correctly, then it already minimizes the difference between the measured data and the estimated data.

Categories

Find more on Polynomials in Help Center and File Exchange

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!