你如何在C ++中执行二次二次拟合?拟合的等式具有以下形式:
$('.class').css('background', '#232222 url("../img/big-team.jpg") no-repeat fixed');
其中a,b,c,d,e和f是拟合参数。编写是否直截了当?是否有可以免费使用的库?
答案 0 :(得分:1)
Use the matrix to get the values of a to f.
[ x1^2 x1^2 x1^2 x1^2 x1^2 x1^2 ] = [ f(x1, y1) ]
[ x1*y1 x2*y2 x3*y3 x4*y4 x5*y5 x6*y6 ] = [ f(x2, y2) ]
[a b c d e f] * [ y1^2 y2^2 y3^2 y4^2 y5^2 y6^2 ] = [ f(x3, y3) ]
[ x1 x2 x3 x4 x5 x6 ] = [ f(x4, y4) ]
[ y1 y2 y3 y4 y5 y6 ] = [ f(x5, y5) ]
[ 1 1 1 1 1 1 ] = [ f(x6, y6) ]
[x] * [T] = [M]
=> [x] = [M] * inverse of [T]