对于给函数fx= 11+25x^2 在区间-11上取xi=-1+02ii=0110试求三次曲线拟合写出详细求解过程。
首先,我们需要计算出10个点的函数值:
f(-1) = 1/(1+25*(-1)^2) = 1/26 f(-0.8) = 1/(1+25*(-0.8)^2) = 1/21 f(-0.6) = 1/(1+25*(-0.6)^2) = 1/14.5 f(-0.4) = 1/(1+25*(-0.4)^2) = 1/9.25 f(-0.2) = 1/(1+25*(-0.2)^2) = 1/5.05 f(0) = 1/(1+250^2) = 1 f(0.2) = 1/(1+250.2^2) = 1/5.05 f(0.4) = 1/(1+250.4^2) = 1/9.25 f(0.6) = 1/(1+250.6^2) = 1/14.5 f(0.8) = 1/(1+250.8^2) = 1/21 f(1) = 1/(1+251^2) = 1/26
接下来,我们使用三次多项式拟合这些点。设拟合函数为g(x),则有:
g(x) = a0 + a1x + a2x^2 + a3*x^3
我们需要求解四个未知数a0、a1、a2、a3。为了方便起见,我们把xi的值按照从小到大排列:
x0=-1, x1=-0.8, x2=-0.6, x3=-0.4, x4=-0.2, x5=0, x6=0.2, x7=0.4, x8=0.6, x9=0.8, x10=1
然后,我们可以把g(x)表示成下面的形式:
g(x) = a0*(1+w0(x)) + a1*(1+w1(x)) + a2*(1+w2(x)) + a3*(1+w3(x))
其中,wi(x)表示第i个节点的基函数,具体形式如下:
w0(x) = (x-x1)(x-x2)(x-x3)/(x0-x1)(x0-x2)(x0-x3) w1(x) = (x-x0)(x-x2)(x-x3)/(x1-x0)(x1-x2)(x1-x3) w2(x) = (x-x0)(x-x1)(x-x3)/(x2-x0)(x2-x1)(x2-x3) w3(x) = (x-x0)(x-x1)(x-x2)/(x3-x0)(x3-x1)(x3-x2)
将10个点代入g(x)中,得到下面的10个方程组:
a0*(1+w0(x0)) + a1*(1+w1(x0)) + a2*(1+w2(x0)) + a3*(1+w3(x0)) = f(x0) a0*(1+w0(x1)) + a1*(1+w1(x1)) + a2*(1+w2(x1)) + a3*(1+w3(x1)) = f(x1) a0*(1+w0(x2)) + a1*(1+w1(x2)) + a2*(1+w2(x2)) + a3*(1+w3(x2)) = f(x2) a0*(1+w0(x3)) + a1*(1+w1(x3)) + a2*(1+w2(x3)) + a3*(1+w3(x3)) = f(x3) a0*(1+w0(x4)) + a1*(1+w1(x4)) + a2*(1+w2(x4)) + a3*(1+w3(x4)) = f(x4) a0*(1+w0(x5)) + a1*(1+w1(x5)) + a2*(1+w2(x5)) + a3*(1+w3(x5)) = f(x5) a0*(1+w0(x6)) + a1*(1+w1(x6)) + a2*(1+w2(x6)) + a3*(1+w3(x6)) = f(x6) a0*(1+w0(x7)) + a1*(1+w1(x7)) + a2*(1+w2(x7)) + a3*(1+w3(x7)) = f(x7) a0*(1+w0(x8)) + a1*(1+w1(x8)) + a2*(1+w2(x8)) + a3*(1+w3(x8)) = f(x8) a0*(1+w0(x9)) + a1*(1+w1(x9)) + a2*(1+w2(x9)) + a3*(1+w3(x9)) = f(x9) a0*(1+w0(x10)) + a1*(1+w1(x10)) + a2*(1+w2(x10)) + a3*(1+w3(x10)) = f(x10)
我们可以用矩阵表示上面的方程组:
|1+w0(x0) 1+w1(x0) 1+w2(x0) 1+w3(x0)| |a0| |f(x0)| |1+w0(x1) 1+w1(x1) 1+w2(x1) 1+w3(x1)| |a1| |f(x1)| |1+w0(x2) 1+w1(x2) 1+w2(x2) 1+w3(x2)| * |a2| = |f(x2)| |1+w0(x3) 1+w1(x3) 1+w2(x3) 1+w3(x3)| |a3| |f(x3)| |1+w0(x4) 1+w1(x4) 1+w2(x4) 1+w3(x4)| |f(x4)| |1+w0(x5) 1+w1(x5) 1+w2(x5) 1+w3(x5)| |f(x5)| |1+w0(x6) 1+w1(x6) 1+w2(x6) 1+w3(x6)| |f(x6)| |1+w0(x7) 1+w1(x7) 1+w2(x7) 1+w3(x7)| |f(x7)| |1+w0(x8) 1+w1(x8) 1+w2(x8) 1+w3(x8)| |f(x8)| |1+w0(x9) 1+w1(x9) 1+w2(x9) 1+w3(x9)| |f(x9)| |1+w0(x10) 1+w1(x10) 1+w2(x10) 1+w3(x10)| |f(x10)|
然后,我们可以使用高斯消元法求解上述线性方程组,得到a0、a1、a2、a3的值。最后,将这些值代入g(x)中,即可得到三次曲线拟合函数
原文地址: http://www.cveoy.top/t/topic/fbX2 著作权归作者所有。请勿转载和采集!