ES 240: Scientific and Engineering Computation. InterpolationPolynomial  Definition –a function f(x) that can be written as a finite series of power functions.

Slides:



Advertisements
Similar presentations
Splines and Piecewise Interpolation
Advertisements

Mark Trew CT Halfway Down Halfway down the stairs Is a stair Where I sit. There isn't any Other stair Quite like It. I'm not at the bottom, I'm.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression Chapter.
CE33500 – Computational Methods in Civil Engineering Differentiation Provided by : Shahab Afshari
MATH 685/ CSI 700/ OR 682 Lecture Notes
Selected from presentations by Jim Ramsay, McGill University, Hongliang Fei, and Brian Quanz Basis Basics.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Chapter 18 Interpolation The Islamic University of Gaza
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
1 Curve-Fitting Spline Interpolation. 2 Curve Fitting Regression Linear Regression Polynomial Regression Multiple Linear Regression Non-linear Regression.
CITS2401 Computer Analysis & Visualisation
Curve Fitting: Splines
Curve-Fitting Interpolation
Chapter 1 Introduction The solutions of engineering problems can be obtained using analytical methods or numerical methods. Analytical differentiation.
Engineering Computation Curve Fitting: Interpolation 1
Curve-Fitting Polynomial Interpolation
Polynomial Interpolation
Development of Empirical Models From Process Data
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 181 Interpolation Chapter 18 Estimation of intermediate.
ECIV 301 Programming & Graphics Numerical Methods for Engineers REVIEW II.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 181 Interpolation.
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Interpolation Chapter 18.
Chapter 6 Numerical Interpolation
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 171 Least.
Differential Equations and Boundary Value Problems
Numerical Integration Formulas
CpE- 310B Engineering Computation and Simulation Dr. Manal Al-Bzoor
CMPS1371 Introduction to Computing for Engineers NUMERICAL METHODS.
Interpolation. Interpolation is important concept in numerical analysis. Quite often functions may not be available explicitly but only the values of.
Scientific Computing Linear and Quadratic Splines.
Curve Fitting and Interpolation: Lecture (I)
Lecture 22 - Exam 2 Review CVEN 302 July 29, 2002.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
1 Interpolation. 2 What is Interpolation ? Given (x 0,y 0 ), (x 1,y 1 ), …… (x n,y n ), find the value of ‘y’ at a.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Applied Numerical Methods With MATLAB ® for Engineers.
Curve Fitting and Regression EEE 244. Descriptive Statistics in MATLAB MATLAB has several built-in commands to compute and display descriptive statistics.
Part 4 Chapter 17 Polynomial Interpolation PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The McGraw-Hill.
Today’s class Spline Interpolation Quadratic Spline Cubic Spline Fourier Approximation Numerical Methods Lecture 21 Prof. Jinbo Bi CSE, UConn 1.
Polynomial Interpolation You will frequently have occasions to estimate intermediate values between precise data points. The function you use to interpolate.
Advanced Topics- Polynomials
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
Chapter 8 Curve Fitting.
Department of Mechanical Engineering, LSU Session IV MATLAB Tutorials Session IV Mathematical Applications using MATLAB Rajeev Madazhy
Chapter 14 Curve Fitting : Polynomial Interpolation Gab Byung Chae.
Curve-Fitting Regression
Computers in Civil Engineering 53:081 Spring 2003 Lecture #15 Spline Interpolation.
Lecture 16 - Approximation Methods CVEN 302 July 15, 2002.
Polynomials, Curve Fitting and Interpolation. In this chapter will study Polynomials – functions of a special form that arise often in science and engineering.
Mohiuddin Ahmad SUNG-BONG JANG Interpolation II (8.4 SPLINE INTERPOLATION) (8.5 MATLAB’s INTERPOLATION Functions)
Principles of Extrapolation
Chapter 13 Objectives Familiarizing yourself with some basic descriptive statistics and the normal distribution. Knowing how to compute the slope and intercept.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
By: Mark Coose Joetta Swift Micah Weiss. What Problems Can Interpolation Solve? Given a table of values, find a simple function that passes through the.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 17 and 18 Interpolation.
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
Interpolation - Introduction
Computational Methods CMSC/AMSC/MAPL 460 Polynomial Interpolation Ramani Duraiswami, Dept. of Computer Science.
Introduction to Programming for Mechanical Engineers
Polynomial Interpolation
Curve-Fitting Spline Interpolation
Interpolation Estimation of intermediate values between precise data points. The most common method is: Although there is one and only one nth-order.
Chapter 18.
Chapter 15 Curve Fitting : Splines
Interpolation.
Chapter 18.
Splines and Piecewise Interpolation
SKTN 2393 Numerical Methods for Nuclear Engineers
SKTN 2393 Numerical Methods for Nuclear Engineers
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM CISE301_Topic1.
Theory of Approximation: Interpolation
Presentation transcript:

ES 240: Scientific and Engineering Computation. InterpolationPolynomial  Definition –a function f(x) that can be written as a finite series of power functions like –f n is a polynomial of order n –A polynomial is represented by coefficient vector from highest power. –p1=[ ]  p1(x) = 3x 4 - 5x 3 – 7x 2 + x + 9

ES 240: Scientific and Engineering Computation. Interpolation Polynomial Operations  poly(r) –convert roots to a polynomial –r=[ ]; poly(r)  roots(p) –find roots of a polynomial – p=[ ] –roots(p)  Y = polyval(p, x) –returns the value of a polynomial, p(x). –P is a vector of length N+1 whose elements are the coefficients of the polynomial in descending powers. –p=[ ]  p(x) = 3x 4 - 5x 3 – 7x 2 + x + 9

ES 240: Scientific and Engineering Computation. Interpolation Polynomial Operations  P = polyfit(x, y, n) –Returns the least squares fit coefficients of a polynomial p(x) of degree n –P is of length N+1.  conv(p1,p2) –multiply two polynomials p1 and p2 –conv(p1,p2)  [q r]=deconv(p1,p2) –polynomials p1 divide by p2, where q is quotient and r is remainder –[q r]=deconv(p1,p2)

ES 240: Scientific and Engineering Computation. Interpolation Polynomial Operations  polyint(p,c) –integrate of polynomial p with integration constant c (default 0) –polyint(p) –polyint(p,1)  polyder(p) –differentiate polynomial p respective to x –>> polyder(p)

ES 240: Scientific and Engineering Computation. Interpolation Curve Fitting  Applications –Estimating the value of points between discrete values –Simplifying complicated functions  Methods –Interpolation Data are very precise curve passes through all points – curve fitting Data are just approximations curve represent a general trend of the data

ES 240: Scientific and Engineering Computation. Interpolation Curve Fitting and Interpolation Curve Fitting (linear or non-linear) Linear Interpolation (most popular interpolation) Other Interpolation (higher order polynomial, spline, nearest,…)

ES 240: Scientific and Engineering Computation. Interpolation Linear Interpolation  The linear interpolation is achieved by fitting a line between two known data points  The resulting formula based on known points x 1 and x 2 and the values of the dependent function at those points is:

ES 240: Scientific and Engineering Computation. Interpolation Quadratic (Polynomial) Interpolation  One problem that can occur with solving for the coefficients of a polynomial is that the system to be inverted is in the form:  Matrices such as that on the left are known as Vandermonde matrices, and they are very ill-conditioned - meaning their solutions are very sensitive to round-off errors.  The issue can be minimized by scaling and shifting the data.

ES 240: Scientific and Engineering Computation. Interpolation Newton Interpolating Polynomials  Another way to express a polynomial interpolation is to use Newton’s interpolating polynomial.  This is a achieved by an extension to linear interpolation

ES 240: Scientific and Engineering Computation. Interpolation Newton Interpolating Polynomials (cont)  The second-order Newton interpolating polynomial introduces some curvature to the line connecting the points, but still goes through the first two points.  The resulting formula based on known points x 1, x 2, and x 3 and the values of the dependent function at those points is:

ES 240: Scientific and Engineering Computation. InterpolationGeneralization  An (n-1) th Newton interpolating polynomial has all the terms of the (n-2) th polynomial plus one extra.  The general formula is: where and the f[…] represent divided differences.

ES 240: Scientific and Engineering Computation. Interpolation Divided Differences  Divided difference are calculated as follows:  Divided differences are calculated using divided difference of a smaller number of terms:

ES 240: Scientific and Engineering Computation. InterpolationExample 15.1 Do by hand Use the newtint function

ES 240: Scientific and Engineering Computation. Interpolation Lagrange Interpolating Polynomials  Weighted average of the two values being connected  The differences between a simple polynomial and Lagrange interpolating polynomials for first and second order polynomials is:  where the L i are weighting coefficients that are functions of x.

ES 240: Scientific and Engineering Computation. Interpolation Lagrange Interpolating Polynomials (cont)  The first-order Lagrange interpolating polynomial may be obtained from a weighted combination of two linear interpolations, as shown.  The resulting formula based on known points x 1 and x 2 and the values of the dependent function at those points is:

ES 240: Scientific and Engineering Computation. Interpolation Lagrange Interpolating Polynomials (cont)  In general, the Lagrange polynomial interpolation for n points is:  where L i is given by:

ES 240: Scientific and Engineering Computation. InterpolationExample 15.1 Solve by hand Use the lagrange function

ES 240: Scientific and Engineering Computation. InterpolationExtrapolation  Extrapolation is the process of estimating a value of f(x) that lies outside the range of the known base points x 1, x 2, …, x n.  Extrapolation represents a step into the unknown, and extreme care should be exercised when extrapolating!

ES 240: Scientific and Engineering Computation. Interpolation Extrapolation Hazards  World population using a 7 th order polynomial extrapolation.

ES 240: Scientific and Engineering Computation. InterpolationOscillations  Higher-order polynomials can not only lead to round-off errors due to ill-conditioning, but can also introduce oscillations to an interpolation or fit where they should not be.  In the figures below, the dashed line represents a function, the circles represent samples of the function, and the solid line represents the results of a polynomial interpolation:

ES 240: Scientific and Engineering Computation. Interpolation Introduction to Splines  An alternative approach to using a single (n-1) th order polynomial to interpolate between n points is to apply lower-order polynomials in a piecewise fashion to subsets of data points.  These connecting polynomials are called spline functions.  Splines minimize oscillations and reduce round- off error due to their lower-order nature.

ES 240: Scientific and Engineering Computation. Interpolation Higher Order vs. Splines  Splines eliminate oscillations by using small subsets of points for each interval rather than every point. This is especially useful when there are jumps in the data: a)3 rd order polynomial b)5 th order polynomial c)7 th order polynomial d)Linear spline seven 1st order polynomials generated by using pairs of points at a time

ES 240: Scientific and Engineering Computation. Interpolation Spline Development a) First-order splines find straight-line equations between each pair of points that Go through the points b) Second-order splines find quadratic equations between each pair of points that Go through the points Match first derivatives at the interior points c) Third-order splines find cubic equations between each pair of points that Go through the points Match first and second derivatives at the interior points Note that the results of cubic spline interpolation are different from the results of an interpolating cubic.

ES 240: Scientific and Engineering Computation. Interpolation Spline Development  Spline function (s i (x))coefficients are calculated for each interval of a data set.  The number of data points (f i ) used for each spline function depends on the order of the spline function.

ES 240: Scientific and Engineering Computation. Interpolation Cubic Splines  While data of a particular size presents many options for the order of spline functions, cubic splines are preferred because they provide the simplest representation that exhibits the desired appearance of smoothness.  In general, the i th spline function for a cubic spline can be written as:  For n data points, there are n-1 intervals and thus 4(n-1) unknowns to evaluate to solve all the spline function coefficients.  There is no ‘one equation’ that can represent the whole spline function on the domain

ES 240: Scientific and Engineering Computation. Interpolation Piecewise Interpolation in MATLAB  MATLAB has several built-in functions to implement piecewise interpolation. The first is spline: yy=spline(x, y, xx)  This performs cubic spline interpolation

ES 240: Scientific and Engineering Computation. InterpolationExample  Generate data: x = linspace(-1, 1, 9); y = 1./(1+25*x.^2);  Calculate 100 model points and determine not-a-knot interpolation xx = linspace(-1, 1); yy = spline(x, y, xx);  Calculate actual function values at model points and data points, the 9-point (solid), and the actual function (dashed), yr = 1./(1+25*xx.^2) plot(x, y, ‘o’, xx, yy, ‘-’, xx, yr, ‘--’)

ES 240: Scientific and Engineering Computation. Interpolation MATLAB’s interp1 Function  While spline can only perform cubic splines, MATLAB’s interp1 function can perform several different kinds of interpolation: yi = interp1(x, y, xi, ‘method’) –x & y contain the original data –xi contains the points at which to interpolate –‘method’ is a string containing the desired method: ‘nearest’ - nearest neighbor interpolation ‘linear’ - connects the points with straight lines ‘spline’ - not-a-knot cubic spline interpolation ‘pchip’ or ‘cubic’ - piecewise cubic Hermite interpolation

ES 240: Scientific and Engineering Computation. InterpolationLab  15.9