egr 105 foundations of engineering i
DESCRIPTION
EGR 105 Foundations of Engineering I. Excel Part III Curve -Fitting, Regression Section 8 Fall 2013. Excel Part II Topics. Data Analysis Concepts Regression Methods Example Function Discovery Regression Tools in Excel Homework Assignment. Analysis of x-y Data. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/1.jpg)
Excel Part III Curve-Fitting, Regression
Section 8 Fall 2013
EGR 105 Foundations of Engineering I
![Page 2: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/2.jpg)
Excel Part II Topics
• Data Analysis Concepts • Regression Methods• Example Function Discovery• Regression Tools in Excel• Homework Assignment
![Page 3: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/3.jpg)
Analysis of x-y Data• Independent versus dependent
variables
y
y = f(x) xindependent
depe
nden
t
![Page 4: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/4.jpg)
Common Types of Plots Example: Y=3X2
log(y) = log(3) + 2*log(x)y = 3x2
Straight Line on log-log Plot!
0 1 2 3 4 5 6 7 8 9 100
50
100
150
200
250
300
350
X
Y
1 100
50
100
150
200
250
300
350
logX
Y
1 101
10
100
1000
logX
logY
Cartesian
Semi-log : log x
log-log : log y-log x
Note!
![Page 5: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/5.jpg)
What About Other Values?
• Often have a limited set of data• What if you want to know…
– Prediction of what occurred before data– Prediction of what will occur after data
• Many real applications of this…– Discuss this in a little while
![Page 6: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/6.jpg)
Finding Other Values• Interpolation
– Data between known points– Need assume variation between points– May be easier to do for closer points
datapoints
![Page 7: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/7.jpg)
Finding Other Values• Extrapolation (requires assumptions)
– Data beyond the measured range– Forecasting (looking ahead)– Hindcasting (looking behind)
• Examples (apply equations or models)– Sales– Ocean waves– Stock market– The weather– etc.
![Page 8: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/8.jpg)
Stock MarketForecasting – can require complex model(s)
![Page 9: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/9.jpg)
Finding Other Values• Regression – curve fitting of data
– Simple representation of data– Understand workings of system
• Elements of system behavior are important– How do they affect the overall system?– How important is each one?
• Can represent these in model(s) – Useful for prediction
![Page 10: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/10.jpg)
Excel Part III Topics
• Data Analysis Concepts • Regression Methods• Example Function Discovery• Regression Tools in Excel• Homework Assignment
![Page 11: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/11.jpg)
Something Must Be In There…Somewhere….
![Page 12: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/12.jpg)
Curve-Fitting - Regression• Useful for noisy or uncertain data
– n pairs of data (xi , yi) • Choose a functional form y = f(x)
• polynomial• exponential • etc.
and evaluate parameters for a “close” fit
![Page 13: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/13.jpg)
What Does “Close” Mean?• Want a consistent rule to determine• Common is the least squares fit (SSE):
(x1,y1) (x2,y2)
(x3,y3) (x4,y4)
x
ye3
ei = yi – f(xi), i =1,2,…,n
sum
squa
red
erro
rs
![Page 14: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/14.jpg)
Quality of the Fit:
Notes: is the average y value0 R2 1-closer to 1 is a “better” fit
x
y
![Page 15: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/15.jpg)
Coefficient of Determination
• R2 = 1.0– All of the data can be explained by the fit
• R2 = 0.0 – None of the data can be explained by the curve fit
(Note: R2 = is sometimes reported as a %)
![Page 16: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/16.jpg)
Caution!!!
• A good fit statistically may not be the correct fit
• Must always consider the physical phenomenon you are attempting to “model”
• Does the fit to the data describe reality?
![Page 17: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/17.jpg)
Linear Regression• Functional choice y = m x + b
slope intercept• Squared errors sum to
• Set m and b derivatives to zero
![Page 18: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/18.jpg)
Further Regression Possibilities:
• Could force intercept: y = m x + c• Other two parameter ( a and b ) fits:
– Logarithmic: y = a ln x + b– Exponential: y = a e bx
– Power function: y = a x b
• Other polynomials with more parameters:– Parabola: y = a x2 + bx + c– Higher order: y = a xk + bxk-1 + …
![Page 19: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/19.jpg)
Excel Part III Topics
• Data Analysis Concepts • Regression Methods• Example Function Discovery• Regression Tools in Excel• Homework Assignment
![Page 20: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/20.jpg)
Example Function Discovery(How to find the “best” relationship)
• Look for straight lines on log axes:– linear on semilog x y = a ln x – linear on semilog y y = a e bx
– linear on log log y = a x b • No rule for 2nd or higher order
polynomial fits
![Page 21: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/21.jpg)
Excel Part III Topics
• Data Analysis Concepts • Regression Methods• Example Function Discovery• Regression Tools in Excel• Homework Assignment
![Page 22: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/22.jpg)
Excel’s Regression Tool• Highlight your chart• On chart menu, select “add trendline”• Choose type:
– Linear, log, polynomial, exponential, power• Set options:
– Forecast = extrapolation – Select y intercept (use zero only if it applies)– Show R2 value on chart– Show equation of fit on chart
![Page 23: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/23.jpg)
Linear & Quartic Curve Fit Example
0 1 2 3 4 5 6 70
1
2
3
4
5
6
7
f(x) = 0.0375 x⁴ − 0.523148 x³ + 2.518056 x² − 3.878439 x + 3.133333R² = 0.997526534200979
0 1 2 3 4 5 6 70
1
2
3
4
5
6
7
f(x) = 0.996703296703297 xR² = 0.997473121604204
Better fit but does it make sense with expected behavior?
Y
Y
X
X
![Page 24: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/24.jpg)
Example Applications
• Look at some curve fitting examples– Examine previous EGR 105 projects
• Pendulum• Elastic bungee cord
![Page 25: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/25.jpg)
Previous EGR 105 Project• Discover how a pendulum’s timing is
impacted by the– length of the string?– mass of the bob?
1. Take experimental data• Use string, weights, rulers, and watches
2. Analyze data and “discover” relationships
![Page 26: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/26.jpg)
Experimental Setup:
Mass
Length
![Page 27: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/27.jpg)
One Team’s Results
Mass appears to have no impact, but length does
![Page 28: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/28.jpg)
To determine the effect of length, first plot the data
![Page 29: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/29.jpg)
Try a linear fit
![Page 30: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/30.jpg)
Force a zero intercept (why?)
![Page 31: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/31.jpg)
Try a quadratic polynomial fit
![Page 32: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/32.jpg)
Try a logarithmic fit
![Page 33: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/33.jpg)
Try a power function fit
![Page 34: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/34.jpg)
On log-log axes, nice straight line
Power Law Relation:
b
![Page 35: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/35.jpg)
Question?
• Which one was the best fit here?• Explain why
![Page 36: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/36.jpg)
One More Example
• Another EGR 105 project• Elastic bungee cord models
– Stretching of an elastic cord• Here we have two models to consider
– Linear elastic (Hooke’s Law)– Non-linear elastic (Cubic model)
![Page 37: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/37.jpg)
Elastic Bungee Cord Models Determined by Curve Fitting the Data
• Linear Model (Hooke’s Law): • Nonlinear Cubic Model:
Linear Fit
Cubic Fit Better and it Makes Sense with the Physics
Force (lb)
Collected Data
![Page 38: EGR 105 Foundations of Engineering I](https://reader036.vdocuments.net/reader036/viewer/2022081419/568163ac550346895dd4c01e/html5/thumbnails/38.jpg)
Homework Assignment #5• See Handout (Excel Part 3)
– Analysis of stress-strain data– Plotting of data– Determine equation for best fit to data
• Regression analysis– Linear elastic model– Cubic polynomial model
• Discussion of results
Remember to email submit using EGR105_5 in Subject Line!