逼近函数的构造(I)—插值 背景 :所得采样数据信息具有较高的真实性和可靠性。 问题 :被插值函数的复杂性和未知特点需构造简单函数(如代数多项式、三角多项式等)来近似表示未知函数。 条件 :在节点处条件完全吻合。 方法 :Lagrange插值,Newton插值,Hermite插值,样条插值,有理插值,连分式插值等。 分析 :误差估计,插值的存在性,唯一性,适定性,不可达点(插值函数验证时不能满足插值条件的节点)分析等。 NOTE: 1 Lagrange插值结构对称、简单易于记忆,然而不具有承袭性。 2 Newton插值结构利用差商作为多项式的系数易于记忆且具有承袭性。 3 Hermite插值注意应用于带导数的插值,对插值函数的光滑性要求较高。 4 Spline插值(大部分会用 cubic spline),该方法是避免一味追求精度和提高次数可能会出现的Runge现象而提出。 5 当被插值函数在某节点处无界或当自变量趋于无穷时有固定的常数时,采用Rational插值和Continued fractional插值效果较好。特别是连分式插值具有递推公式,便于计算插值函数。 6 应用时根据需要灵活选择相应的插值方法。 7 应用案例 Conventional computerised tomography systems (CT) are usually equipped with polyenergetic X-ray sources, which prevents accurate density measurements because of the general CT-image artefact called beam hardening (BH). BH results in false gradients of the linear attenuation coefficient in the CT cross section images, indicating a non-existent density or composition gradient in the imaged object. A number of methods have been proposed to correct for, or limit the effect of, beam hardening. One of these is called linearisation of the CT-data, in which the polyenergetic CT-data are transformed to monoenergetic CT-data. This requires knowledge of the CT-data as a function of object thickness. Data points to derive this function are usually measured using a set of samples of different object material thicknesses at the imaging parameter settings used and fitted with a polynomial. However, the sample preparation makes this method tedious to use. In this work a simulation method has been developed, which can accurately simulate the polyenergetic CT-data for any arbitrary object material and thickness if a priori information of the object material density and composition exists. The simulation method requires detailed knowledge of the imaging system, that is, X-ray energy spectra, detector response and information transfer from detector to digitised data. Besides developing the simulation tool, it has been shown that one of the major difficulties with this BH-correction method is to accurately determine the curvature of the function representing the polyenergetic CT-data. Earlier proposed endorsements to fit a second-degree polynomial to the polyenergetic CT-data are not sufficient to describe its curvature, at least a polynomial of degree eight or higher is required. Here cubic-spine interpolation is used, which avoids the problem. (1998)"Correction for beam hardening artefacts in computerised tomography." J Xray Sci Technol 8(1): 75-93.
Origin软件提供了多种非线性拟合工具,可以在“分析”菜单栏下找到。其中的多项式拟合对于许多不规则的函数曲线有比较好的拟合功能,一般需要选择合适的阶数才能达到比较好的拟合效果。下面针对一个实际例子,说明在应用多项式拟合功能时需要注意的问题。以某两列数据为例,其图形如下图: 上图中空白圆点为给定的数据点,而红线为多项式拟合得到的曲线,其项数取为9阶,对应的多项式表达式为: Y =-0.19458+1.80324E-4*X-5.26164E-9*X^2-7.17185E-13*X^3+4.99335E-17*X^4 -1.3961E-21*X^5+2.11857E-26*X^6-1.83728E-31*X^7+8.59577E-37*X^8-1.68907E-42*X^9 相关系数R^2=0.99179,与给定数据点拟合很好。但使用该表达式时需要特别注意,在X比较大的情况下,多项式的高次项将会对计算结果产生较大的影响。图中的红点是采用上述表达式得到的对应X点处的Y值,在X=80000时,函数值即与实验点和曲线发生了较大偏离。很明显,这是由于小数点舍入误差的原因造成的,因此,这个表达式还不能应用。否则在取较大X值时将产生发散现象。对于这个问题,有两种处理方法: 1、加大多项式中小数点后的位数,从而保证精度; 2、适当降低多项式的阶数,将高次项的影响降低,从而得到合理的曲线。 第一种方法这里不再述及,给出第2种处理方法。如下图: 从上图可以看出,按阶数=6得到的表达式可以应用。用Fortran计算得到的离散点(红点)与实验数据吻合的也较好。附Fortran程序: program test implicit none integer x,y,time,tmax real ft,A,b1,b2,b3,b4,b5,b6 parameter(A=-0.36515,B1=2.84281E-4,B2=-2.36972E-8,B3=7.33018E-13,B4=-1.07321E-17,B5=7.56699E-23,B6=-2.07544E-28) open(unit=10,file='ft.txt') tmax=100000 do time=0,tmax,10000 ft=A+B1*(time)+B2*(time)**2.0+B3*(time)**3.0+B4*(time)**4.0+B5*(time)**5.0+B6*(time)**6.0 write(10,*) time,ft enddo close(10) end 从上面的实例可以看出,在进行多项式拟合时,多项式阶数的选择是比较关键的。