Презентация PowerPoint

Lecture 17: Polynomial interpolation. Runge example. Download rungepoly.m Runge phenomenon polydomial wiggle associated rith high degree polynomial interpolation function rungepoly(n) % interpolate Runge function with polynomial % estimated at uniformly spaced points % input: n - degree of polynomial % plot runge function xmin=-1; xmax=1; f = inline('1./(1 + 12*x.^2)'); x = linspace(xmin,xmax,200); % interpolation with equidistant points x = linspace(xmax,xmin,n); y = f(x); p=polyfit(x,y,n-1); xvec=linspace(xmin,xmax,500); yvec=polyval(p,xvec); yexact= f(xvec); plot(xvec,yvec,'b',x,y,'ro',xvec,yexact,'r--'); legend('Interpolation','Interpolating points','Exact solution'); end Result: >> rungepoly(10) 1.2 Interpolation Interpolating points Exact solution

1 0.8 0.6 0.4 0.2 0 -0.2 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1

Result: >> rungepoly(20) 2 Interpolation Interpolating points Exact solution 1.5 1 0.5 0 -0.5 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4

0.6 0.8 1 Runge example with Chebyshev interpolation. Download rungecheb.m The nth Chebyshev polynomial is given by Tn(x) = cos(n arrcos(x)) All the zeros of Tn(x) lie in [-1,+1] and can be calculated by xi = cos((2i-1) pi/2n) where odd is an odd integer. The use of the zeros of the Chebyshev nodes as interpolation points ensures that the maximum of the interpolation error will be minimized. function rungecheb(n) % interpolate Runge function with polynomial % estimated at Chebychev points % input: n - degree of polynomial % plot runge function xmin=-1; xmax=1; f = inline('1./(1 + 12*x.^2)'); x = linspace(xmin,xmax,200); % interpolation with equidistant points x = chebroots(n); y = f(x); p=polyfit(x,y,n-1); xvec=linspace(xmin,xmax,500); yvec=polyval(p,xvec); yexact= f(xvec); plot(xvec,yvec,'b',x,y,'ro',xvec,yexact,'r--');

legend('Interpolation','Interpolating points','Exact solution'); title('interpolation at Chebyshev points') end function x = chebroots(n) % compute roots of Chebyshev polinomial % % input: n - order of polynomial for k=1:n x(k)=cos( pi*(2*k-1)/(2*n) ); end end Result: >> rungecheb(10) interpolation at Chebyshev points 1 Interpolation Interpolating points Exact solution 0.9 0.8 0.7 function 0.6 Compare to equally spaced points: 0.5 1.2

0.4 Interpolation Interpolating points Exact solution 1 0.3 0.8 0.2 0.6 0.1 0 -1 0.4 0.2 -0.8 -0.6 -0.4 -0.2 0 0.2

0.4 0.6 0.8 1 0 -0.2 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Result:

>> rungecheb(20) interpolation at Chebyshev points 1 Interpolation Interpolating points Exact solution 0.9 0.8 0.7 Compare to equally spaced points: 0.6 0.5 2 0.4 0.3 Interpolation Interpolating points Exact solution 1.5 0.2 1 0.1 0 -1

0.5 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 0 -0.5 -1 -0.8 -0.6 -0.4 -0.2

0 0.2 0.4 0.6 0.8 1 Inclass The following data are related to the life expectances of citizens of two European regions. 1975 1980 1985 1990 WE: 72.8 74.2 75.2 76.4 EE: 70.2 70.2 70.3 71.2 Interpolate each set of data with a polynomial of degree 3 and estimate the life expectances in 1970, 1983, and 1988. Plot each fit along with the data and label your plots.

Recently Viewed Presentations

• From theGlobal SAI Stocktaking Report 2014: "when comparing the extent of support to the INTOSAI region's country distribution and its overall SAI results, it becomes clear that the distribution of funds from donors, are not corresponding with the level of...
• Directions. The HSD Elementary assessments are neither scripted nor timed assessments. They are a tool to inform instructional decision making. All students should "move toward
• What words do you think of when you hear. Root Cause Analysis? @EducateIN @ntwilliamson @GinaGRomano ? This is a Pear Deck Text Slide ? To edit the type of question, go back to the "Ask Students a Question" in the...
• Improving Budget Credibility: Budget Formulation Process by Florence N. Kuteesa Public Financial Management Advisor IMF East AFRITAC. Seminar on Budget Management and Public Financial Accountability in Sub-Saharan Africa, 18-22 June, 2007 Pretoria, South Africa.
• Country Jigsaw September 22, 2010 ... chemicals, transport equipment, energy products, minerals and nonferrous metals, textiles and clothing, food, beverages, and tobacco Exports: engineering products, textiles and clothing, production machinery, motor vehicles, transport equipment, chemicals ...
• A Thousand Acres: King Lear in a Cornfield "A family portrait that is also a near-epic investigation into the broad landscape, the thousand dark acres of the human heart. . . . The book has all the stark brutality of...
• Palmetto Battery METL Assessment April 25, 2017 * Overall Assessment Last Year This Year Academic P P Military P TP Moral-Ethical P T Physical Fitness P P * T = Trained P = Needs Practice U = underprepared Academic Assessment...
• Park and Burgess realized that ecological and economic factors were converted into a social organization by the traditions and aspirations of city dwellers. In their efforts to achieve objectivity, these sociologists never lost sight of the values that propel human...