EXCEL Integration Engineering 25 Bruce Mayer, PE

advertisement
Engineering 25
EXCEL
Integration
Bruce Mayer, PE
Registered Electrical & Mechanical Engineer
BMayer@ChabotCollege.edu
ENGR/MTH/PHYS25: Computational Methods
1
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
Excel Numerical Integration
 Game Plan: Divide
Unknown Area into
Strips (or boxes),
and Add Up
ENGR/MTH/PHYS25: Computational Methods
2
 Employ Trapezoidal
rule with used
Slanted-Line tops
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
 Trapezoidal
Elements
Area  Avg - Hgt  Width 
 By
Trapezoid
Geometry
ya 
Avg - Hgt   yb   ya 
y avg
yb
2
Width   xb  xa
dA
dx
ENGR/MTH/PHYS25: Computational Methods
3
 Then the
Incremental
Area
 y  ya 
dA   b
 xb  xa 
2


Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
Trapezoidal Integration by Excel
 Integrate over 1.7-4.3 using Excel
y  8e
x 5

sin 9 x
0.63
 That is, Find
Iy  
8e
x  4.3
x 1.7
x 5

sin 9 x
0.63
  ln 
 ln 
7x
7 x dx
 Show Game Plan on Next Slides
ENGR/MTH/PHYS25: Computational Methods
4


Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
The Function Plotted
XY Function for Integration
7.0
6.5
6.0
5.5
5.0
4.5
4.0
3.5
3.0
Y, A
2.5
2.0
1.5
1.0
0.5
0.0
-0.5
-1.0
 

-1.5
y  8e  x 5 sin 9 x 0.63  ln
-2.0
7x

-2.5
-3.0
-3.5
1.7
1.9
2.1
2.3
2.5
Bmayer file: XY_Integration_0912.xls
ENGR/MTH/PHYS25: Computational Methods
5
2.7
2.9
3.1
3.3
3.5
3.7
3.9
4.1
X
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
4.3
Set Up Integration Strips
7
6
5
4
3
y
2
1
0
-1
-2
-3
2
2.5
ENGR/MTH/PHYS25: Computational Methods
6
3
x
3.5
4
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
Integration Equations
 dA = [Avg Strip Hgt]*[Strip Width]
yavg   yn  yn 1  2
dx  xn  xn 1
dA  yavg  dx
N
N
n2
n2
A   dA   yn  yn 1  2xn  xn 1 
ENGR/MTH/PHYS25: Computational Methods
7
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
Integration Result
 See next Slide for Graphic
 Note the relationship between y(x) and
Iy(x)
d
d
I y   y  x dx 
Iy 
y  x dx  y  x 

dx
dx
 Since is Iy(x) is the ANTI-Derivative of
y(x), then y(x) is the Derivative of Iy(x)


• Can use y(x) to find Max/Min values of Iy(x)
• Can use y(x) to find Max/Min slopes of Iy(x)
ENGR/MTH/PHYS25: Computational Methods
8
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
XY Function for Integration
7.0
6.5
6.0
5.5
5.0
Max/Min
Local Values
4.5
4.0
3.5
3.0
Y, A
2.5
2.0
1.5
Maximum
Local Slopes
1.0
0.5
0.0
-0.5
-1.0
-1.5
Y
CumArea
ZeroLine
-2.0
-2.5
-3.0
-3.5
1.7
1.9
2.1
2.3
2.5
BMayer file: XY_Integration_1112.xls
ENGR/MTH/PHYS25: Computational Methods
9
2.7
2.9
3.1
3.3
3.5
3.7
3.9
X
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
4.1
4.3
Data Acq integration – NO Fcn
XY DataAcq Plot
3
Q (W)
3
Q (W)
2
2
1
1
0
0:00:00
1:12:00
2:24:00
BMayer Chabot College 0502..xls
ENGR/MTH/PHYS25: Computational Methods
10
3:36:00
4:48:00
6:00:00
7:12:00
Time (hrs)
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
Time in Excel  DAYS
 Regardless of how TIME is DISPLAYED
in a spreadsheet table, Excel
ENCODES time in DAYS
 Any “time” format can be converted to
Fractional Days using either of
• reFORMAT the current Cell
• Copy-n-Paste VALUES into a numberformatted cell
 Excel uses this “Day Code” to Add
and/or Subtract Dates & Times
ENGR/MTH/PHYS25: Computational Methods
11
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
Time↔DayCode Equivalency
Time Format Equivalent Decimal Fraction of a day
12:00:00
24:00:00
6:00:00
8:00:00
0:03:11
1:30:45
19:50:20
ENGR/MTH/PHYS25: Computational Methods
12
0.5000
1.0000
0.2500
0.3333
0.0022
0.0630
0.8266
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
Excel HELP on DATE Codes
 In Excel the “Date
Codes Start at the
“zero hour” of the
year 1900
 See Excel help for
more information
 Remember all
Times & Dates are
internally stored as
DAYS
ENGR/MTH/PHYS25: Computational Methods
13
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
ENGR/MTH/PHYS25: Computational Methods
14
Bruce Mayer, PE
BMayer@ChabotCollege.edu • ENGR-25_EXCEL_Integration_Tutorial-Example.pptx
MATLAB Code
% Bruce Mayer, PE * 07Dec09
% ENGR36 * EXCEL integration Prob
% file = Excel_Integ_Stem_0912.m
%
% Set up WhtBd Graphic to show
% integration Strips
%
x = [1.7:.05:4.3]
y = 8*exp(-0.2*x).*sin(9*x.^0.63) +
log(sqrt(7*x))
stem(x,y), grid, axis([1.6 4.4 -3.5 7])
Download