《MATLAB数值计算》(美)Cleve B.Moler 第三章插值第1节插值多项式 毕业设计(论文)英文文献翻译.doc

上传人:小小飞 文档编号:3905012 上传时间:2019-10-10 格式:DOC 页数:9 大小:294.52KB
返回 下载 相关 举报
《MATLAB数值计算》(美)Cleve B.Moler 第三章插值第1节插值多项式 毕业设计(论文)英文文献翻译.doc_第1页
第1页 / 共9页
《MATLAB数值计算》(美)Cleve B.Moler 第三章插值第1节插值多项式 毕业设计(论文)英文文献翻译.doc_第2页
第2页 / 共9页
《MATLAB数值计算》(美)Cleve B.Moler 第三章插值第1节插值多项式 毕业设计(论文)英文文献翻译.doc_第3页
第3页 / 共9页
《MATLAB数值计算》(美)Cleve B.Moler 第三章插值第1节插值多项式 毕业设计(论文)英文文献翻译.doc_第4页
第4页 / 共9页
《MATLAB数值计算》(美)Cleve B.Moler 第三章插值第1节插值多项式 毕业设计(论文)英文文献翻译.doc_第5页
第5页 / 共9页
点击查看更多>>
资源描述

《《MATLAB数值计算》(美)Cleve B.Moler 第三章插值第1节插值多项式 毕业设计(论文)英文文献翻译.doc》由会员分享,可在线阅读,更多相关《《MATLAB数值计算》(美)Cleve B.Moler 第三章插值第1节插值多项式 毕业设计(论文)英文文献翻译.doc(9页珍藏版)》请在三一文库上搜索。

1、 Chapter 3InterpolationInterpolation is the process of defining a function that takes on specified values at specified points. This chapter concentrates on two closely related interpolants, the piecewise cubic spline and the shape-preserving piecewise cubic named “pchip”.3.1 The Interpolating Polyno

2、mialWe all know that two points determine a straight line. More precisely, any two points in the plane, and, with , determine a unique first degree polynomial in whose graph passes through the two points. There are many different formulas for the polynomial, but they all lead to the same straight li

3、ne graph.This generalizes to more than two points. Given points in the plane, ,, with distinct s, there is a unique polynomial in of degree less than whose graph passes through the points. It is easiest to remember that , the number of data points, is also the number of coefficients, although some o

4、f the leading coefficients might be zero, so the degree might actually be less than . Again, there are many different formulas for the polynomial, but they all define the same function.This polynomial is called the interpolating polynomial because it exactly re- produces the given data.,Later, we ex

5、amine other polynomials, of lower degree, that only approximate the data. They are not interpolating polynomials.The most compact representation of the interpolating polynomial is the La- grange form.There are terms in the sum and terms in each product, so this expression defines a polynomial of deg

6、ree at most . Ifis evaluated at , all the products except the th are zero. Furthermore, the th product is equal to one, so the sum is equal to and the interpolation conditions are satisfied.For example, consider the following data set:x=0:3;y=-5 -6 -1 16;The commanddisp(x;y)displays 0123-5-6-116The

7、Lagrangian form of the polynomial interpolating this data isWe can see that each term is of degree three, so the entire sum has degree at most three. Because the leading term does not vanish, the degree is actually three. Moreover, if we plug in or 3, three of the terms vanish and the fourth produce

8、s the corresponding value from the data set.Polynomials are usually not represented in their Lagrangian form. More fre- quently, they are written as something likeThe simple powers of x are called monomials and this form of a polynomial is said to be using the power form.The coefficients of an inter

9、polating polynomial using its power form,can, in principle, be computed by solving a system of simultaneous linear equationsThe matrix of this linear system is known as a Vandermonde matrix. Its elements areThe columns of a Vandermonde matrix are sometimes written in the opposite order, but polynomi

10、al coefficient vectors in Matlab always have the highest power first.The Matlab function vander generates Vandermonde matrices. For our ex- ample data set,V = vander(x)generatesV =00011111842127931Thenc = Vycomputes the coefficientsc =1.00000.0000-2.0000-5.0000In fact, the example data was generated

11、 from the polynomial .One of the exercises asks you to show that Vandermonde matrices are nonsin- gular if the points are distinct. But another one of the exercises asks you to show that a Vandermonde matrix can be very badly conditioned. Consequently, using the power form and the Vandermonde matrix

12、 is a satisfactory technique for problems involving a few well-spaced and well-scaled data points. But as a general-purpose approach, it is dangerous.In this chapter, we describe several Matlab functions that implement various interpolation algorithms. All of them have the calling sequencev = interp

13、(x,y,u)The first two input arguments, and , are vectors of the same length that define the interpolating points. The third input argument, , is a vector of points where the function is to be evaluated. The output, v, is the same length as u and has elements Our first such interpolation function, pol

14、yinterp, is based on the Lagrange form. The code uses Matlab array operations to evaluate the polynomial at all the components of u simultaneously.function v = polyinterp(x,y,u)n = length(x);v = zeros(size(u);for k = 1:nw = ones(size(u);for j = 1:k-1 k+1:nw = (u-x(j)./(x(k)-x(j).*w;endendv = v + w*y

15、(k); To illustrate polyinterp, create a vector of densely spaced evaluation points.u = -.25:.01:3.25;Thenv = polyinterp(x,y,u);plot(x,y,o,u,v,-)creates figure 3.1.Figure 3.1. polyinterpThe polyinterp function also works correctly with symbolic variables. For example, createsymx = sym(x)Then evaluate

16、 and display the symbolic form of the interpolating polynomial withP = polyinterp(x,y,symx)pretty(P)produces-5 (-1/3 x + 1)(-1/2 x + 1)(-x + 1) - 6 (-1/2 x + 3/2)(-x + 2)x-1/2 (-x + 3)(x - 1)x + 16/3 (x - 2)(1/2 x - 1/2)xThis expression is a rearrangement of the Lagrange form of the interpolating po

17、ly- nomial. Simplifying the Lagrange form withP = simplify(P)changes P to the power formP =x3-2*x-5Here is another example, with a data set that is used by the other methods in this chapter.x = 1:6;y = 16 18 21 17 15 12;disp(x; y)u = .75:.05:6.25;v = polyinterp(x,y,u);plot(x,y,o,u,v,-);produces12345

18、6161821171512creates figure 3.2.Figure 3.2. Full degree polynomial interpolationAlready in this example, with only six nicely spaced points, we can begin to see the primary difficulty with full-degree polynomial interpolation. In between the data points, especially in the first and last subintervals

19、, the function shows excessive variation. It overshoots the changes in the data values. As a result, full- degree polynomial interpolation is hardly ever used for data and curve fitting. Its primary application is in the derivation of other numerical methods.第三章 插值多项式插值就是定义一个在特定点取给定值得函数的过程。本章的重点是介绍两

20、个紧密相关的插值函数:分段三次样条函数和保形分段三次插值函数(称为“pchip”)3.1插值多项式人们知道两点确定一条直线,或者更确切地说,平面上任意两点和,只要,就唯一确定一个关于的一次多项式,其图形经过这两个点。对于这个多项式,有多种不同的公式表示,但是它们都对应同一个图形。把上述讨论推广到多于两个点的情况。则对于平面上有着不同值的个点,存在唯一一个关于的次数小于的多项式,使其图形经过这些点。很容易可看出,数据点的数目也是多项式系数的个数。尽管,一些首项的系数可能是零,但多项式的次数实际上也小于。同样,这个多项式可能有不同的公式表达式,但它们都定义着同一个函数。这样的多项式称为插值(int

21、erpolating)多项式,它可以准确地重新计算出初始给定的数据:,后面,我们会考察另外一些较低次的多项式,这些多项式只能接近给定的数据,因此它们不是插值多项式。表示插值多项式的最紧凑的方式是拉格朗日(Lagrange)形式在这个公式中,对项进行亲和,而每一个连乘符号中含有项,因此它定义的多项式最高次数为。当时计算,除了第项外,其他的乘积都为零,同时,这第项乘积正好为1,所以求和结果为,满足插值条件。例如,考虑下面一组数据。x=0:3;y=-5 -6 -1 16;输入命令disp(x;y)其输出为 0 1 2 3 -5 -6 -1 16这些数据的拉格朗日形式的多项式为可以看出上式为四个三次多

22、项式求和,因此最后结果最高为三。由于求和后最高次项系数不为零,所以此式就是一个三次多项式。而且,如果将或者3代入上式,其中有三项都为零,而第四项结果正好符合给定数据。一个多项式通常不用拉格朗日形式表示,它更常见地写成类似的形式。其中简单的的次方项称为单项式(momomial),而多项式的这种形式称为使用幂形式(power form)的多项式。插值多项式使用幂形式表示为其中的系数,原则上可以通过求解下面的线性代数方程组得到。这个线性方程组的系数矩阵记为,也被称为范德尔蒙(Vandermonde)矩阵,该矩阵的各个元素为上述范德尔蒙矩阵的各列,有时也按相反的顺序排列,但在MATLAB中,多项式系数

23、向量,通常按从高次幂到低次幂排列。MATLAB中的函数vander可以生成范德尔蒙矩阵,例如对于前面的那组数据,V=vander(x)生成V = 0 0 0 1 1 1 1 1 8 4 2 1 27 9 3 1然后,输入命令c=Vy计算出插值系数。c = 1.0000 0.0000 -2.0000 -5.0000事实上,这个例子的数据就是根据多项式生成的。在本章的习题3.6中,要证明当插值点的位置互不相同时,范德尔蒙矩阵是非奇异的。而在练习3.19中,则请读者证明范德尔蒙矩阵的条件可能非常差。通过两个练习我们可以发现,对于一组间隔比较均匀、函数值变化不大的数据,适合采用幂形式的插值多项式和范德

24、尔蒙矩阵进行求解。但对于一般的问题,这个方法有时是危险的。在本章中,将介绍几个能实现各种插值算法的MATLAB函数,它们都采用下面的调用格式前两个输入参数,和,是长度相同的向量,它们定义了插值点。第三个参数,为要计算函数值的范围上的点组成的向量。输出向量和长度相等,其分量。要介绍的第一个这样的插值函数是polyinterp,它基于拉格朗日形式。程序使用了MATLAB的数组操作,来同时计算出多项式在向量各分量上的值。function v=plyinterp(x,y,u)n=length(x); v=zeros(size(u);for k=1:n w=ones(size(u); for j=1:k

25、-1 k+1:n w=(u-x(j)./(x(k)-x(j).*w; end v=v+w*y(k);end为了解释polyinterp函数的功能,先构造一个间隔很密的求值点向量。u=-0.25:0.01:3.25;然后输入命令v=polyinterp(x,y,u);plot(x,y,o,u,v,-);可生成图3_1。函数polyinterp也可以处理符号变量,例如,创建符号变量symx=sym(x) 然后用下面的命令,计算并显示插值多项式的符号形式P=polyinterp(x,y,symx)Pretty(P)其输出结果为-5(-1/3x+1)(-1/2x+1)(-x+1)-6(-1/2x+3/

26、2)(-x+2)x-1/2(-x+3)(x-1)x+16/3(x-2(1/2x-1/2)x将其进行简化,从而得到P的幂形式P= x3-2*x-5下面是另一个例子,使用的是本章另一种方法所用数据。x=1:6; y=16 18 21 17 15 12;disp(x;y);u=.75:.05:6.25;v=polyinterp(x,y,u);plot(x,y,o,u,v,-);运行后结果为 1 2 3 4 5 616 18 21 17 15 12同时输出图3_2。 图3_1 polyinterp 图3_2完整次数(full_degree)多项式插值在这个仅包含6个正常间距插值值点的例子里,我们已经可以看出,完整次数多项式插值的主要问题了。在数据点之间,特别是第一个和第二个点之间,函数值表现出很大的变化。它超出了给定数据值的变化,因此,完整次数多项式插值很少用于实际的数据或曲线拟合,它主要用于推导出其他的数值方法。 完成时间: 2013.3.10第 9 页 共 25页

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1