This preview shows pages 1–4. Sign up to view the full content.
CGN 3421  Computer Methods
Gurley
Numerical Methods Lecture 5  Curve Fitting Techniques
page 86 of 99
Numerical Methods Lecture 5  Curve Fitting Techniques
Topics
motivation
interpolation
linear regression
higher order polynomial form
exponential form
Curve fitting 
motivation
For root finding, we used a given function to identify where it crossed zero
where does
??
Q: Where does this given function
come from in the first place?
•
Analytical models of phenomena (e.g. equations from physics)
•
Create an equation from observed data
1) Interpolation
(connect the datadots)
If data is reliable, we can plot it and connect the dots
This is piecewise, linear interpolation
This has limited use as a general function
Since its really a group of small
s, connecting one point to the next
it doesn’t work very well for data that has built in random error (scatter)
2) Curve fitting
 capturing the trend in the data by assigning a single function across the entire range.
The example below uses a straight line function
A straight line is described generically by
f(x) = ax + b
The goal
is to identify the coefficients ‘a’ and ‘b’ such that f(x) ‘fits’ the data well
H Z
()
±
²
H Z
H Z
H Z
Interpolation
Curve Fitting
f(x) = ax + b
f(x) = ax + b
for each line
for entire range
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document CGN 3421  Computer Methods
Gurley
Numerical Methods Lecture 5  Curve Fitting Techniques
page 87 of 99
other examples of data sets that we can fit a function to.
Is a straight line suitable for each of these cases ?
No. But we’re not stuck with just straight line fits. We’ll start with straight lines, then expand the concept.
Linear curve fitting (linear regression)
Given the general form of a straight line
How can we pick the coefficients that best fits the line to the data?
First question: What makes a particular straight line a ‘good’ fit?
Why does the blue line appear to us to fit the trend better?
•
Consider the distance between the data and points on the line
•
Add up the length of all the red and blue verticle lines
•
This is an expression of the ‘error’ between data and fitted line
•
The one line that provides a minimum
error is then the ‘best’
straight line
time
height of
dropped
object
Oxygen in
soil
temperature
soil depth
pore
pressure
Profit
paid labor hours
H Z
()
CZ
D
±
²
CGN 3421  Computer Methods
Gurley
Numerical Methods Lecture 5  Curve Fitting Techniques
page 88 of 99
Quantifying error in a curve fit
assumptions:
1) positive or negative error have the same value
(data point is above or below the line)
2) Weight greater errors more heavily
we can do both of these things by squaring
the distance
denote data values as (x, y)
==============>>
denote points on the fitted line as (x, f(x))
sum the error at the four data points
Our fit is a straight line, so now substitute
The ‘best’ line has
minimum error
between line and data points
This is called the
least squares approach
, since we minimize the square of the error.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview. Sign up
to
access the rest of the document.
This note was uploaded on 06/10/2011 for the course CGN 3421 taught by Professor Long during the Spring '08 term at University of Florida.
 Spring '08
 Long

Click to edit the document details