Fitting Equations to Data
-
Upload
karen-salva -
Category
Documents
-
view
223 -
download
0
Transcript of Fitting Equations to Data
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 1/49
Reporters:Badilla, Harriet G.
Salva, Karen Frances Remey A.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 2/49
� Spatial profile (Temp. vs. Time)
� Time history (Voltage vs. Time)
� Cause-and-effect (Force as a Function of Displacement)
� System output as a function of input (Yield of
a chemical reaction as a function of temperature)
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 3/49
� To determine the equation of a curve thatrepresents the aggregate of the data
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 4/49
� The overall strategy in fitting the curve to a
set of data points is to determine anappropriate set of value for the coefficients in
the equation of the chosen curve.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 5/49
� Determine the value of the coefficients a and
b in the straight-line equation y= ax + b so
that the line will pass through n data points.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 6/49
� Open a new worksheet and enter the x-data
(independent variable) in the leftmost
column� Enter the y-data (dependent variable) in the
next column
�
Plot the data as an x-y graph (i.e., an XYchart) with arithmetic coordinate. Do notinterconnect the individual data points
� Click on one of the plotted data points
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 7/49
� Choose Add Trendline from the Chart menu.
Then specify the type of curve and request
any pertinent options when the resultingdialog box appears.
� Press the OK button. The curve fitting willthen be carried out and the results displayed
automatically
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 8/49
� An engineer has measured the force exerted
by a spring as a function of its displacement
from its equilibrium position. The ff. datahave been obtained:
Data Point No. Distance (cm) Force (N)
2 2.0
2 4 3.5
3 7 4.5
4 11 8.0
5 17 9.5
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 9/49
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 10/49
y = 0.514x + 1.279
R² = 0.957
0.0
2.0
4.0
6.0
8.0
10.0
12.0
0.0 5.0 10.0 15.0 20.0
Force Exerted By A Spring
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 11/49
� Determine the values of a and b in the
equation y=ax + b in such manner that the
sum of the squares of the errors will beminimized
� Wrote each error term as ei = y i f( x i )e
i = y
i ( ax
i + b )
� Z = sum of the squares of the errors (SSE)z= ei
2 + e22 + e 3
2 + . . .
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 12/49
� A. Exponential functions
y = aebx
ln y = ln a + bx
Let u= ln y and c= ln a
u = bx + c
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 13/49
� The transient behavior of a capacitor has
been studied by measuring the voltage drop
across the device as a function of time. Theff. data obtained:
Time, sec Voltage Time, sec Voltage
0 10 6 0.5
1 6.1 7 0.3
2 3.7 8 0.2
3 2.2 9 0.1
4 1.4 10 0.07
5 0.8 12 0.03
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 14/49
y = 9.7534e-0.4923x
R² = 0.9988
0
2
4
6
8
10
12
0 2 4 6 8 10 12 14
Capacitor Discharge Rate
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 15/49
� B. Logarithmic Functions
y = a ln x + b
� C. Power Functions
y = ax b
ln y = ln a + b ln x
let u= ln x, v= ln y and c= ln a
v = bu + c
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 16/49
� A chemical engineer is studying at a rate at
which a reactant is consumed in a chemical
reaction involving the manufacture apolymer. The ff. data have been
obtained, showing the reaction rate (mol/sec)as function of the concentration of the
reactant (mol/cu.ft.)
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 17/49
Concentration, mol/cu.ft. Reaction Rate, mol/sec.
100 2.85
80 2.00
60 1.25
40 0.67
20 0.22
10 0.0725 0.024
1 0.0018
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 18/49
y = 0.0018x1.599
R² = 1
0
0.5
1
1.5
2
2.5
3
3.5
0 20 40 0 80 100 120
Reaction Rate vsConcentration
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 19/49
� D. Polynomials
y = c1 + c2x + c3x2 + . . . + ck+1xk
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 20/49
� The ff. table presents the time for a high-
performance sports car to reach the various
speeds. The times are given in seconds andthe speeds in miles per hour.
� Fit an equation to the data, thus obtaining anaccurate mathematical relationship bet.
Acceleration time and top speed.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 21/49
Top speed, mph Time, sec.
30 1.9
40 2.8
50 3.8
60 5.2
70 6.5
80 8.3
90 10.4
100 12.7
110 15.6
120 19.0
130 23.2
140 31.2
150 45.1
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 22/49
y = 0.0000x5 - 0.0000x4 + 0.0008x3 - 0.0525x2 + 1.7770x - 20.9580
R² = 0.9998
0.0
5.0
10.0
15.0
20.0
25.0
30.0
35.0
40.0
45.0
50.0
0 20 40 60 80 100 120 140 160
AccelerationTime vsTop Speed
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 23/49
Some guideline that may prove helpful, asoutlined below:
1. Try to plot the data as a straight line. If this issuccessful, it will indicate the function thatshould be used to represent the data.
2. It a straight-line relationship cant beobtained, try fitting different types of curvesto the data.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 24/49
3. If a satisfactory curve fit cant be obtained
using the first two guidelines, try plotting
the data differently.
4. In some cases, a better fit may be obtainedby scaling the data so that the magnitude of
the x-values is more-or-less the same as they-values.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 25/49
� A. Plotting the Data as a Straight Line
EquationType Equation Coordinate System
Exponential y = aebx log y versus x (semi-log)
Logarithmic y = a ln x + b y versus log x (semi-log)
Power y = ax b
log y versus x (log-log)
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 26/49
� A. Plotting the Data as a Straight Line
Thus, if the data appear as a straight line whenplotted in one of these coordinate systems, wewill have a clear indication of what type of trendline to fit the data.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 27/49
� In example 5.7, a power function was used torepresent a set of data. The selection of thepower function was based upon previousfamiliarity with the process from which the datahad been obtained. Verify the desirability of thepower function by plotting the data onarithmetic coordinates, semi-log coordinates(both log y versus x and x versus log y), and log-log coordinates. Seek a coordinate system thatwill result in a straight-line relationship.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 28/49
Concentration, mol/cu.ft. Reaction Rate, mol/sec.
100 2.85
80 2.00
60 1.25
40 0.67
20 0.22
10 0.072
5 0.024
1 0.0018
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 29/49
Conc. Rxn Rate
100 2.85
80 260 1.25
40 0.67
20 0.22
10 0.072
5 0.024
1 0.0018
y = 0.028x - 0.228
R² = 0.970
-0.50
0.00
0.50
1.00
1.50
2.00
2.50
3.00
3.50
0.00 20.00 40.00 60.00 80.00 100.00 120.00
Rxn Rate vsConc
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 30/49
y = 0.019e0.059x
R² = 0.763
0.00
0.01
0.10
1.00
10.00
0.00 20.00 40.00 60.00 80.00 100.00 120.00
RR vsConc
(semi-log plot on the y-axis)y = 0.533ln(x) - 0.691
-1.00
-0.50
0.00
0.50
1.00
1.50
2.00
2.50
3.00
3.50
1.00 10.00 100.00
RR vsConc
(semi-log plot on the x-axis)
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 31/49
y = 0.001x1.599
R² = 1
0.00
0.01
0.10
1.00
10.00
1.00 10.00 100.00
RR vsConc
(log-log plot)
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 32/49
� B. Fitting Multiple Functions to a Given Data
Set We may find that several different functions will
represent the data reasonably well. If severaldifferent functions appear to fit the data (using
visual inspection) more or less equally well, thesum of the squares of the errors (SSE) and the r2
may be helpful in deciding which function fitsbest.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 33/49
� In example 5.8, we represented some
performance data for several popular sports
cars with a fifth-degree polynomial. Expandthis study by fitting several other commonly
used functions to the data. Determine whichfunction best fits the data by comparing their
respective SSE and r2 values.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 34/49
R² = 0.8384
-10.0
0.0
10.0
20.0
30.0
40.0
50.0
0 20 40 60 80 100 120 140 160
Linear (Straight Line) R² = 0.9657
0.0
5.0
10.0
15.0
20.0
25.0
30.0
35.0
40.0
45.0
50.0
0 20 40 60 80 100 120 140 160
2nd-Deg Polynomial
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 35/49
R² = 0.9715
0.0
5.0
10.0
15.0
20.0
25.0
30.0
35.0
40.0
45.0
50.0
0 20 40 60 80 100 120 140 160
Power R² = 0.9909
0.0
5.0
10.0
15.0
20.0
25.0
30.0
35.0
40.0
45.0
50.0
0 20 40 60 80 100 120 140 160
3rd-Deg Polynomial
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 36/49
R² = 0.9922
0.0
5.0
10.0
15.0
20.0
25.0
30.0
35.0
40.0
45.0
50.0
0 20 40 60 80 100 120 140 160
Exponential R² = 0.9981
0.0
5.0
10.0
15.0
20.0
25.0
30.0
35.0
40.0
45.0
50.0
0 20 40 60 80 100 120 140 160
4th-Deg Polynomial
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 37/49
R² = 0.9998
0.0
5.0
10.0
15.0
20.0
25.0
30.0
35.0
40.0
45.0
50.0
0 20 40 60 80 100 120 140 160
5th-Deg Polynomial R² = 0.9999
0.0
5.0
10.0
15.0
20.0
25.0
30.0
35.0
40.0
45.0
50.0
0 20 40 60 80 100 120 140 160
6th-Deg Polynomial
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 38/49
Function Visual Assessment r2 SSE
Straight Line Poor 0.8384 312.0
2nd-Degree Polynomial Poor 0.965 66.237
Power Poor 0.9715 55.03
3rd-Degree Polynomial Fair 0.9909 17.57
Exponential Good 0.9922 15.06
4th-Degree Polynomial Good 0.9981 3.669
5th-Degree Polynomial Excellent 0.9998 0.3862
6th-Degree Polynomial Excellent 0.9999 0.1931
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 39/49
� C. Substituting Other Variables for y and x
It may be helpful to substitute
1/y for y
1/x for x
x1/2 for x
y1/2 for y
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 40/49
� The following data represent the rate at
which an oxygenation reaction occurs within
a water purification chamber as a function of temperature. The data were obtained by a
civil engineer, who must now plot the dataand fit an appropriate equation through the
data.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 41/49
Temperature, K Reaction Rate, moles/sec
253 0.12
258 0.17
263 0.24
268 0.34
273 0.48
278 0.66
283 0.91
288 1.22
293 1.64
298 2.17
303 2.84
308 3.70
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 42/49
y = 2E-05x3 - 0.017x2 + 4.414x - 381.8
R² = 0.999
0.00
0.50
1.00
1.50
2.00
2.50
3.00
3.50
4.00
250 260 270 280 290 300 310 320
Reacti Rate vs Temperat reTemp Rxn Rate
253 0.12
258 0.17
263 0.24
268 0.34
273 0.48
278 0.66
283 0.91
288 1.22
293 1.64
298 2.17
303 2.84
308 3.70
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 43/49
1/Temp Rxn Rate
0.00395 0.12
0.00388 0.17
0.00380 0.24
0.00373 0.34
0.00366 0.48
0.00360 0.66
0.00353 0.91
0.00347 1.22
0.00341 1.64
0.00336 2.17
0.00330 2.84
0.00325 3.70
y = 28,666,742.1324e-4,887.2323x
R² = 0.9999
0.10
1.00
10.00
0.00300 0.00320 0.00340 0.00360 0.00380 0.00400 0.00420
Reaction Rate vs InverseTemp
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 44/49
� D. Scaling the Data
When fitting a curve to a data, it is sometimeshelpful to scale the data so that the magnitudes of the y-values do not differ significantly from themagnitudes of the x-values.
It is recommended to redefine one of the values of the variables so hat it is expressed in terms of somemultiple of the original unit of measurement.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 45/49
� A group of environmental engineers andscientists have made a prediction of the damageto the ozone layer in the northern hemisphere asa function of time, based upon present trendsrelated to the use of fluorocarbon compounds.The ff. scenario has been suggested. (thethickness of the ozone layer is expressed in
terms of arbitrary scale ranging from 0-1). Fit anequation to the data, expressing the ozone layervalue as a function of time.
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 46/49
Year Ozone Layer
1995 1.00
1996 0.97
1997 0.881998 0.76
1999 0.63
2000 0.50
2001 0.39
2002 0.30
2003 0.22
2004 0.17
2006 0.11
2007 0.10
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 47/49
y = 8E-06x5 - 0.084x4 + 336.5x3 - 67460x2 + 7E+08x - 3E+11
R² = 1
0.00
0.20
0.40
0.60
0.80
1.00
1.20
1994 1996 1998 2000 2002 2004 2006 2008
Change in the Ozone Layer
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 48/49
y = 8E-06x5 - 0.000x4 + 0.006x3 - 0.047x2 + 0.011x + 1
R² = 1
0.00
0.20
0.40
0.60
0.80
1.00
1.20
0 2 4 6 8 10 12 14
Change in the Ozone Layer
8/4/2019 Fitting Equations to Data
http://slidepdf.com/reader/full/fitting-equations-to-data 49/49