Lecture11b

# Lecture11b - 0306-381 Applied Programming Lecture Eleven...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 0306-381 Applied Programming Lecture Eleven •Curve Fitting Using MS-Excel FInterpolation Interpolation Process of estimating values using between known values • Uses information known about the environment rather than fitting measurements • Used for interface of disparate systems • Typically on-line process 3 Interpolation Example Design of digital display data accurate to 0.25 • Display: integer values from 0 to 10 • Sensor: outputs values such as 0.00, 0.25, 0.50, 0.75, 1.00, etc. • Problem: What is most appropriate integer? Interpolation Example 10 9 8 7 6 5 4 3 2 1 0 0.00 2.00 4.00 6.00 8.00 10.00 4 y a l p s i D Display2 Display3 Display1 Sensor Output Interpolation Characteristics How does interpolation compare to and contrast with curve fitting? • Data points: interpolation uses only a few points, and resulting function includes those points • Processing: interpolation is on-line • Accuracy: generally less accurate than curve fitting Given some idea of what curve should look like, use “live” data measurements to interpolate the desired value on the spot. 5 Interpolation Function Determine function that includes known points: f (x) • n known points: {(xi, yi)}, i Î [1, n] • f (xi) = yi " i Î [1, n] 6 Linear Lagrange Interpolation Interpolation function is a straight line: f (x) • Interpolates based on 2 data points • Equation of straight line through these 2 points x - x2 x - x1 f ( x) = y1 + y2 x1 - x2 x2 - x1 7 Quadratic Lagrange Interpolation Interpolation function is quadratic: f (x) • Interpolates based on 3 data points • Quadratic function passes through these 3 points ( x - x2 )( x - x3 ) ( x - x1 )( x - x3 ) ( x - x1 )( x - x2 ) f ( x) = y1 + y3 y2 + ( x1 - x2 )( x1 - x3 ) ( x2 - x1 )( x2 - x3 ) ( x3 - x1 )( x3 - x2 ) 8 Quadratic Lagrange Interpolation Example Three data points (N = 3) • (x1, y1) = (15, 10) • (x2, y2) = (20, 11) • (x3, y3) = (25, 20) ( x - 20)( x - 25) ( x - 15)( x - 25) ( x - 15)( x - 20) f ( x) = 10 + 11 + 20 (15 - 20)(15 - 25) (20 - 15)(20 - 25) (25 - 15)(25 - 20) 9 Lagrange Interpolation Lagrange interpolating function: f (x) • Interpolates based on N data points • Polynomial of degree N - 1 N Õ( x - x j ) Õ ( xi - x j ) j =1 j ¹i j =1 j ¹i N N f ( x) = å i =1 yi • Computational complexity increases quickly with N – 2 points: 4 Add/Sub., 2 Mult., 2 Div. – 3 points: 8 Add/Sub., 9 Mult., 3 Div. – n points: O(n2) Add/Sub., O(n2) Mult., O(n) Div. 10 ...
View Full Document

## This note was uploaded on 04/27/2010 for the course EECC 0306-381 taught by Professor Roymelton during the Spring '10 term at RIT.

Ask a homework question - tutors are online