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

1 次查看(过去 30 天)
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!

回答(1 个)

Andrew Ouellette
Andrew Ouellette 2022-11-11
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.

类别

Help CenterFile Exchange 中查找有关 Polynomials 的更多信息

产品


版本

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by