且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C ++中的简单曲线拟合实现(SVD最小二乘拟合或类似拟合)

更新时间:2022-06-22 06:59:01

假设您要适合形式为

    y = ax^2 + bx + c 

到您的5个数据点,那么您所要做的就是求解一个3 x 3的矩阵方程。请看以下示例 http://www.personal.psu.edu /jhm/f90/lectures/lsq2.html -它可以解决您似乎正在描述的相同问题(仅使用更多数据点)。如果您对微积分有基本的了解,并且能够反转3x3矩阵(或者数值上更好的东西-我猜您是这样做的,因为您在问题标题中特别提到了SVD),那么此示例将阐明您需要做的事情。

to your 5 data points, then all you will need is to solve a 3 x 3 matrix equation. Take a look at this example http://www.personal.psu.edu/jhm/f90/lectures/lsq2.html - it works through the same problem you seem to be describing (only using more data points). If you have a basic grasp of calculus and are able to invert a 3x3 matrix (or something nicer numerically - which I am guessing you do given you refer specifically to SVD in your question title) then this example will clarify what you need to do.