Interpolation Methods

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.
Numeriska beräkningar i Naturvetenskap och Teknik Today’s topic: Approximations Least square method Interpolations Fit of polynomials Splines.
Pattern Recognition and Machine Learning: Kernel Methods.
Numerical Methods.  Polynomial interpolation involves finding a polynomial of order n that passes through the n+1 points.  Several methods to obtain.
Data mining and statistical learning - lecture 6
MATH 685/ CSI 700/ OR 682 Lecture Notes
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.
Finite element method – basis functions 1 Finite Elements: Basis functions 1-D elements  coordinate transformation  1-D elements  linear basis functions.
EARS1160 – Numerical Methods notes by G. Houseman
ES 240: Scientific and Engineering Computation. InterpolationPolynomial  Definition –a function f(x) that can be written as a finite series of power functions.
IGERT: SPH and Free Surface Flows Robert A. Dalrymple Civil Engineering.
1cs542g-term Notes  Added required reading to web (numerical disasters)
3D Geometry for Computer Graphics. 2 The plan today Least squares approach  General / Polynomial fitting  Linear systems of equations  Local polynomial.
Radial Basis Functions
Curve-Fitting Regression
Polynomial Interpolation
Probability & Statistics for Engineers & Scientists, by Walpole, Myers, Myers & Ye ~ Chapter 11 Notes Class notes for ISE 201 San Jose State University.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 24 Regression Analysis-Chapter 17.
Lecture 9 Interpolation and Splines. Lingo Interpolation – filling in gaps in data Find a function f(x) that 1) goes through all your data points 2) does.
Many quadratic equations can not be solved by factoring. Other techniques are required to solve them. 7.1 – Completing the Square x 2 = 20 5x =
Radial Basis Networks: An Implementation of Adaptive Centers Nivas Durairaj ECE539 Final Project.
6 – 4: Factoring and Solving Polynomial Equations (Day 1)
EGR 1101 Unit 7 Systems of Linear Equations in Engineering (Chapter 7 of Rattan/Klingbeil text)
CpE- 310B Engineering Computation and Simulation Dr. Manal Al-Bzoor
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Curve Fitting ~ Least Squares Regression Chapter.
CIS V/EE894R/ME894V A Case Study in Computational Science & Engineering HW 5 Repeat the HW associated with the FD LBI except that you will now use.
Simpson Rule For Integration.
Scientific Computing Linear Least Squares. Interpolation vs Approximation Recall: Given a set of (x,y) data points, Interpolation is the process of finding.
V. Space Curves Types of curves Explicit Implicit Parametric.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
MECN 3500 Inter - Bayamon Lecture 9 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
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.
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.
Chapter 8 Curve Fitting.
Curve-Fitting Regression
6. Introduction to Spectral method. Finite difference method – approximate a function locally using lower order interpolating polynomials. Spectral method.
GG 313 Geological Data Analysis Lecture 13 Solution of Simultaneous Equations October 4, 2005.
1 Finite Elements. 2 Finite elements Formally identical to spectral technique Dependent variables expanded as linear combinations of basis local, non.
Lecture 22 Numerical Analysis. Chapter 5 Interpolation.
INFORMATIK A Multi-scale Approach to 3D Scattered Data Interpolation with Compactly Supported Basis Functions Yutaka Ohtake Yutaka Ohtake Alexander Belyaev.
Lecture 16 - Approximation Methods CVEN 302 July 15, 2002.
Jump to first page Chapter 3 Splines Definition (3.1) : Given a function f defined on [a, b] and a set of numbers, a = x 0 < x 1 < x 2 < ……. < x n = b,
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)
CHAP 3 WEIGHTED RESIDUAL AND ENERGY METHOD FOR 1D PROBLEMS
Spline Interpolation A Primer on the Basics by Don Allen.
Math 4030 – 11b Method of Least Squares. Model: Dependent (response) Variable Independent (control) Variable Random Error Objectives: Find (estimated)
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 4 Chapter 15 General Least Squares and Non- Linear.
Principles of Extrapolation
using Radial Basis Function Interpolation
Curve Fitting Introduction Least-Squares Regression Linear Regression Polynomial Regression Multiple Linear Regression Today’s class Numerical Methods.
1 Chapter 4 Interpolation and Approximation Lagrange Interpolation The basic interpolation problem can be posed in one of two ways: The basic interpolation.
Objectives: Be able to….. Distinguish between rational and irrational numbers. Understand what is meant by a surd. Simplify expressions involving surds.
Interpolation Local Interpolation Methods –IDW – Inverse Distance Weighting –Natural Neighbor –Spline – Radial Basis Functions –Kriging – Geostatistical.
Interpolation - Introduction
Polynomial Equations and Factoring
Solving Quadratic Equations by Completing the Square
Curve-Fitting Spline Interpolation
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.
Least Squares Fitting A mathematical procedure for finding the best-fitting curve to a given set of points by minimizing the sum of the squares of the.
Discrete Least Squares Approximation
Theory of Approximation: Interpolation
Presentation transcript:

Interpolation Methods Robert A. Dalrymple Johns Hopkins University

Why Interpolation? For discrete models of continuous systems, we need the ability to interpolate values in between discrete points. Half of the SPH technique involves interpolation of values known at particles (or nodes).

Interpolation To find the value of a function between known values. Consider the two pairs of values (x,y): (0.0, 1.0), (1.0, 2.0) What is y at x = 0.5? That is, what’s (0.5, y)?

Linear Interpolation Given two points, (x1,y1), (x2,y2): Fit a straight line between the points. y(x) = a x +b a=(y2-y1)/(x2-x1), b= (y1 x2-y2 x1)/(x2-x1), Use this equation to find y values for any x1 < x < x2

Polynomial Interpolants Given N (=4) data points, Find the interpolating function that goes through the points: If there were N+1 data points, the function would be with N+1 unknown values, ai, of the Nth order polynomial

Polynomial Interpolant Force the interpolant through the four points to get four equations: Rewriting: The solution is found by inverting p (N+1) x (N+1) matrix equation

Example Data are: (0,2), (1,0.3975), (2, -0.1126), (3, -0.0986). Fitting a cubic polynomial through the four points gives:

Matlab code for polynomial fitting % the data to be interpolated (in 1D) x=[-0.2 .44 1.0 1.34 1.98 2.50 2.95 3.62 4.13 4.64 4.94]; y=[2.75 1.80 -1.52 -2.83 -1.62 1.49 2.98 0.81 -2.14 -2.93 -1.81]; plot(x,y,'bo') n=size(x,2) % CUBIC FIT p=[ones(1,n) x x.*x x.*(x.*x)]' a=p\y' %same as a=inv(p)*y' yp=p*a hold on; plot(x,yp,'k*') Note: linear and quadratic fit: redefine p

Polynomial Fit to Example Exact: red Polynomial fit: blue

Beware of Extrapolation Exact: red An Nth order polynomial has N roots!

Least Squares Interpolant For N points, we will have a fitting polynomial of order m < (N-1). The least squares fitting polynomial be similar to the exact fit form: Now p is N x m matrix. Since we have fewer unknown coefficient as data points, the interpolant cannot go through each point. Define the error as the amount of “miss” Sum of the (errors)2:

Least Squares Interpolant Minimizing the sum with respect to the coefficients a: Solving, This can be rewritten in this form, which introduces a pseudo-inverse. Reminder: for cubic fit

Question Show that the equation above leads to the following expression for the best fit straight line:

Matlab: Least-Squares Fit %the data to be interpolated (1d) x=[-0.2 .44 1.0 1.34 1.98 2.50 2.95 3.62 4.13 4.64 4.94]; y=[2.75 1.80 -1.52 -2.83 -1.62 1.49 2.98 0.81 -2.14 -2.93 -1.81]; plot(x,y,'bo') n=size(x,2) % CUBIC FIT p=[ones(1,n) x x.*x x.*(x.*x)]' pinverse=inv(p'*p)*p' a=pinverse*y' yp=p*a plot(x,yp,'k*')

Cubic Least Squares Example What does a linear fit look like? What does a 10th order polynomial look like? Data irregularly spaced x: -0.2 .44 1.0 1.34 1.98 2.50 2.95 3.62 4.13 4.64 4.94 y: 2.75 1.80 -1.52 -2.83 -1.62 1.49 2.98 0.81 -2.14 -2.93 -1.81

Least Squares Interpolant Cubic Least Squares Fit: * is the fitting polynomial o is the given data Exact

Piecewise Interpolation Piecewise polynomials: fit all points Linear: continuity in y+, y- (fit pairs of points) Quadratic: +continuity in slope Cubic splines: +continuity in second derivative RBF All of the above, but smoother Can do matlab cubic splines fast?

Radial Basis Functions Developed to interpolate 2-D data: think bathymetry. Given depths: , interpolate to a rectangular grid.

Radial Basis Functions 2-D data: For each position, there is an associated value: Radial basis function (located at each point): where is the distance from xj The radial basis function interpolant is:

RBF To find the unknown coefficients i, force the interpolant to go through the data points: where This gives N equations for the N unknown coefficients.

RBF Morse et al., 2001

Multiquadric RBF MQ: RMQ: Hardy, 1971; Kansa, 1990

RBF Example 11 (x,y) pairs: (0.2, 3.00), (0.38, 2.10), (1.07, -1.86), (1.29, -2.71), (1.84, -2.29), (2.31, 0.39), (3.12, 2.91), (3.46, 1.73), (4.12, -2.11), (4.32, -2.79), (4.84, -2.25) SAME AS BEFORE

RBF Errors Log10 [sqrt (mean squared errors)] versus c: Multiquadric

RBF Errors Log10 [ sqrt (mean squared errors)] versus c: Reciprocal Multiquadric

Consistency Consistency is the ability of an interpolating polynomial to reproduce a polynomial of a given order. The simplest consistency is constant consistency: reproduce unity. where, again, If gj(0) = 1, then a constraint results: Note: Not all RBFs have gj(0) = 1

RBFs and PDEs Solve a boundary value problem: The RBF interpolant is: N is the number of arbitrarily spaced points; the j are unknown coefficients to be found.

RBFs and PDEs Introduce the interpolant into the governing equation and boundary conditions: These are N equations for the N unknown constants, j

RBFs and PDEs (3) Problem with many RBF is that the N x N matrix that has to be inverted is fully populated. RBFs with small ‘footprints’ (Wendland, 2005) 1D: 3D: 1D: quartic in r 2D: quintic in r His notation: Advantages: matrix is sparse, but still N x N

Wendland 1-D RBF with Compact Support Max=1 What would Wendland’s kernels look like in SPH?

Moving Least Squares Interpolant are monomials in x for 1D (1, x, x2, x3) x,y in 2D, e.g. (1, x, y, x2, xy, y2 ….) Note aj are functions of x

Moving Least Squares Interpolant Define a weighted mean-squared error: where W(x-xi) is a weighting function that decays with increasing x-xi. Same as previous least squares approach, except for W(x-xi)

Weighting Function q=x/h

Moving Least Squares Interpolant Minimizing the weighted squared errors for the coefficients: , , , P same as before

Moving Least Squares Interpolant Solving The final locally valid interpolant is:

Moving Least Squares (1) % generate the data to be interpolated (1d) x=[-0.2 .44 1.0 1.34 1.98 2.50 2.95 3.62 4.13 4.64 4.94]; y=[2.75 1.80 -1.52 -2.83 -1.62 1.49 2.98 0.81 -2.14 -2.93 -1.81]; plot(x,y,'bo') n=size(x,2) % QUADRATIC FIT p=[ones(1,n) x x.*x]' xfit=0.30; sum=0.0 % compute msq error for it=1:18, % fiting at 18 points xfit=xfit+0.25; d=abs(xfit-x) for ic=1:n q=d(1,ic)/.51; % note 0.3 works for linear fit; 0.51 for quadratic if q <= 1. Wd(1,ic)=0.66*(1-1.5*q*q+0.75*q^3); elseif q <= 2. Wd(1,ic)=0.66*0.25*(2-q)^3; else Wd(1,ic)=0.0; end end Moving Least Squares (1)

MLS (2) Warray=diag(Wd); A=p'*(Warray*p) B=p'*Warray acoef=(inv(A)*B)*y' % QUADRATIC FIT yfit=acoef'*[1 xfit xfit*xfit]' hold on; plot(xfit, yfit,'k*') sum=sum+(3.*cos(2.*pi*xfit/3.0)-yfit)^2; end

MLS Fit to (Same) Irregular Data h=0.51 Given data: circles; MLS: *; exact: line

1.0 .3 Varying h Values 1.5 .5

Conclusions There are a variety of interpolation techniques for irregularly spaced data: Polynomial Fits Best Fit Polynomials Piecewise Polynomials Radial Basis Functions Moving Least Squares