离散数学名词 插值( 二 )

ksincπ(t-tk) (注:k为下标)这里sk代表在时间tk=t0+k*T时的抽样值,T是抽样时间,它的倒数1/T叫做抽样频率 。此公式表示,已知在规则分布的区间中的抽样值sk,我们就可以根据辛克函式先测出抽样值,然后将它们相加,这样计算出任意时间t上的值 。编程使用matlab中使用插值函式插值函式(the function of interpolation )interp1调用函式的格式(Syntax)yi = interp1(x,Y,xi)yi = interp1(Y,xi)yi = interp1(x,Y,xi,method)yi = interp1(x,Y,xi,method,'extrap')yi = interp1(x,Y,xi,method,extrapval)pp = interp1(x,Y,method,'pp')调用格式说明(Description)yi = interp1(x,Y,xi) 返回矢量X和Y决定的根据输入的节点xi时对应的y的值.矢量Y是矢量X的一个函式映射.如果Y是一个矩阵,那幺插值结果是一个对应的矩阵.[=================================================== yi = interp1(x,Y,xi) returns vector yi containing elements corresponding to the elements of xi and determined by interpolation within vectors x and Y. The vector x specifies the points at which the data Y is given. If Y is a matrix, then the interpolation is performed for each column of Y and yi is length(xi)-by-size(Y,2).===================================================]yi = interp1(x,Y,xi,method)插值中可以使用的方法:插值方法说明nearest临近的两点插值linear线性插值(默认)spline三次样条插值pchip分段三次Hermite插值多项式插值cubic(作用于pchip相同)v5cubic用matlab5版本中断三次样条插值[====================================================yi = interp1(x,Y,xi,method) interpolates using alternative methods:methodDescriptionnearestNearest neighbor interpolationlinearLinear interpolation (default)splinesplineCubic spline interpolationpchipPiecewise cubic Hermite interpolationcubic(Same as 'pchip')v5cubicCubic interpolation used in MATLAB 5======================================================]简单程式示例>>x=[0.0 0.1 0.195 0.3 0.401 0.5];>>y=[0.39849 0.39695 0.39142 0.38138 0.36812 0.35206];>>plot(x,y);>>T=interp1(x,y,.25,'linear') %线性插值(返回结果T=0.3862)>> T=interp1(x,y,.25,'nearest') % 两点插值(返回结果T=0.3814)>>T=interp1(x,y,.25,'spline')% 三次样条插值(返回结果T =0.3867) >>T=interp1(x,y,.25,'cubic') %三次插值(返回结果T =0.3867)