DATA FITTING EXAMPLES
DATA FITTING EXAMPLES
Example: Least-Squares Regression.
Consider the set of data:
|
x
|
f
|
|
1
|
0.5
|
|
2
|
2.5
|
|
3
|
2.0
|
|
4
|
4.0
|
|
5
|
3.5
|
|
6
|
6.0
|
|
7
|
5.5
|
Use one-dimensional arrays for the
x and
f data.
Fit a linear equation through the data using a least-squares regression. Compute the error using the second norm.
Answer:
f = 0.07142857 + 0.8392857x with a second norm error of 2.998.