Curve Fitting Filling in the gaps Copyright G

  • Slides: 28
Download presentation
Curve Fitting Filling in the gaps Copyright G. A. Tagliarini, Ph. D

Curve Fitting Filling in the gaps Copyright G. A. Tagliarini, Ph. D

Basic Problem l l Given sample points x 1 < x 2 < …<

Basic Problem l l Given sample points x 1 < x 2 < …< xn and sample data values y 1, y 2, …, yn corresponding to the xi, for 1 ≤ i ≤ n Find a function f such that y 1 = f(x 1), y 2 = f(x 2), …, yn = f(xn) – – 2 Typically an approximate match is sought Additional design constraints, such as continuity or differentiability may apply 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Least Squares Approximation 3 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Least Squares Approximation 3 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Estimating Values l l 4 Interpolation is estimating the value of the data generating

Estimating Values l l 4 Interpolation is estimating the value of the data generating function for x ε [x 1, xn] and x ≠ xi. Extrapolation is estimating the value of the data generating function for x outside the interval [x 1, xn]. 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Recall from Analytic Geometry (x 2, y 2) (x 1, y 1) 5 (x

Recall from Analytic Geometry (x 2, y 2) (x 1, y 1) 5 (x 2, y 1) 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Piece-wise Linear Interpolation (x 2, y 2) (xn, yn) (x 1, y 1) (x

Piece-wise Linear Interpolation (x 2, y 2) (xn, yn) (x 1, y 1) (x 3, y 3) 6 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Polynomial Interpolation l A polynomial p(x) is a function of the form p(x) =

Polynomial Interpolation l A polynomial p(x) is a function of the form p(x) = anxn + an-1 xn-1+…+a 1 x+a 0 – – l 7 If n is the largest power of x for which an ≠ 0, then p(x) is of degree n The n+1 coefficients ai are the undetermined values Assume n+1 samples to find a polynomial of degree n that passes through the sample points…Does one exist? How to find it? 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Polynomial Approximation l l Polynomials are universal approximators for continuous functions on closed intervals

Polynomial Approximation l l Polynomials are universal approximators for continuous functions on closed intervals Weierstrass Approximation Theorem – – l 8 Given F(x) continuous on [a, b] and any e>0 no matter how small There exists a polynomial f(x) such that |F(x)-f(x)|<e for all x in [a, b] This is an existence theorem. 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Polynomial Interpolation Process 9 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Polynomial Interpolation Process 9 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Re-writing as a Matrix Equation 10 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Re-writing as a Matrix Equation 10 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Conditions for a Solution l l Given the linear system y = X a

Conditions for a Solution l l Given the linear system y = X a from the previous slide X-1 exists so that we can find a = X-1 y if the xi are all distinct – – – 11 This condition was met by our initial assumptions For many curve fitting problems (e. g. , regression) this assumption is unmet X rapidly becomes ill-conditioned as n increases 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Example: Polynomial Fit l l 12 Find a cubic passing through (-1, -11), (0,

Example: Polynomial Fit l l 12 Find a cubic passing through (-1, -11), (0, -5), (1, -5), and (2, 1) Graph System 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Example: Polynomial Fit (continued) 13 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Example: Polynomial Fit (continued) 13 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Example: Polynomial Fit (continued) 14 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Example: Polynomial Fit (continued) 14 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Lagrange Polynomials l l 15 Expansion using the natural basis 1, x, x 2,

Lagrange Polynomials l l 15 Expansion using the natural basis 1, x, x 2, …, xn, … may give rise to numerical difficulties from searching for the inverse of an illconditioned matrix An alternative basis may provide a better representation 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Lagrange Polynomial Definition 16 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Lagrange Polynomial Definition 16 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Example Lagrange Polynomials 17 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Example Lagrange Polynomials 17 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Example Lagrange Polynomials 18 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Example Lagrange Polynomials 18 11/23/2020 Copyright G. A. Tagliarini, Ph. D

An Orthogonality Property l l 19 Qk(xj) = 1 if k=j Qk(xj) = 0

An Orthogonality Property l l 19 Qk(xj) = 1 if k=j Qk(xj) = 0 if k≠j 11/23/2020 Copyright G. A. Tagliarini, Ph. D

The Approximation Formula 20 11/23/2020 Copyright G. A. Tagliarini, Ph. D

The Approximation Formula 20 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Plotting the Lagrange Polynomials and Their Sum 21 11/23/2020 Copyright G. A. Tagliarini, Ph.

Plotting the Lagrange Polynomials and Their Sum 21 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Lagrange Example Finished l l 22 For the data points (-1, -11), (0, -5),

Lagrange Example Finished l l 22 For the data points (-1, -11), (0, -5), (1, -5), and (2, 1) The polynomial f is given by f(x) = -11 Q 1(x)+ -5 Q 2(x) + -5 Q 3(x) + 1 Q 4(x) = 2 x 3 – 3 x 2 + 1 x – 5 which by now should look familiar! (Can you show this? ) 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Linear Correlation l l l 23 Data may be represented in a scattergram Positive

Linear Correlation l l l 23 Data may be represented in a scattergram Positive correlation results when the dependent variable’s (y) values increase as the independent variable’s (x) values increase. Negative correlation results when the dependent variable’s (y) values decrease as the independent variable’s (x) values increase. 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Sample Scattergrams 24 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Sample Scattergrams 24 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Notation l l 25 X and Y represent the distributions of independent and dependent

Notation l l 25 X and Y represent the distributions of independent and dependent variable values Critical values of r depend upon the significance level a of the test (typically, a=0. 05 or a=0. 01), the type of test (one tail or two tail), and the number of data pairs n 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Pearson’s r: The Coefficient of Correlation 26 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Pearson’s r: The Coefficient of Correlation 26 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Prediction Equation 27 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Prediction Equation 27 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Cubic Splines 28 11/23/2020 Copyright G. A. Tagliarini, Ph. D

Cubic Splines 28 11/23/2020 Copyright G. A. Tagliarini, Ph. D