EGR 105

advertisement
EGR 105
Foundations of Engineering I
Excel Part I
Basics and Simple Plotting
Section 008 Fall 2013
Excel Part I Topics
•
•
•
•
•
Excel basics
Cell referencing
Math functions
Charts (plots)
Homework Assignment
Excel Basics
• Workbook
organization
– Cells (row/column)
– Worksheets
(names)
• Entering and
formatting data
• Copy and paste
• Fill
• Simple math
–
–
–
–
+, –, *, /, ^
Entry starts with =
“autosum”
Relative copy for
math operations
• Data sort
• Split window
Excel Part I Topics
•
•
•
•
•
Excel basics
Cell referencing
Math functions
Charts (plots)
Homework Assignment
Referring to Individual Cells
• Standard way: row column notation [r, c]
– Actually, letter number (can be changed)
– Updates when copying cells (“relative reference”)
• Example: C27
– For fixed, add $ sign (“absolute cell reference”)
• Example: $C$27
• Cell names – can “rename” cells by
changing content of box on upper left
– Useful for formulas
Excel Part I Topics
•
•
•
•
•
Excel basics
Cell referencing
Math functions
Charts (plots)
Homework Assignment
More Complicated Math
• What if you had to compute…
f ( x) = sin 2 x + log x
or
n
n
s=
å (x - m)
i =1
i
n -1
2
1
m = å xi
n i=1
n = number of
points
Built-in Functions in Excel
• Syntax:
– Entry always starts with an equal sign (=)
– Next is the name of the function followed by
parentheses containing parameters or values
to be operated on (arguments)
– Examples: = SUM ( A10:C20 ) or = SUM ( $A$10:$C$20 )
= SQRT ( B17 ) or = SQRT ( $B$17)
• Many types available
Built-in Functions in Excel
• Some work on single arguments, some
on groups of arguments, some on none
• Composition of functions works also:
= SQRT ( SUM ( A10:B17 ) )
• How to invoke:
– Know the name of the function
– Excel’s function wizard: f x
Elementary Math
= SQRT (x)
= ABS (x)
= FACT (x)
= SUM (x1,x2,…)
= GCD (x1,x2,…)
= LCM (x1,x2,…)
= CEILING (x1,x2,…)
= ROUND (x)
= SUM (x1,x2,…)
= COUNT (x1,x2,…)
= EXP (x)
= LOG (x)
= LOG10 (x)
= POWER (x,y)
= RAND ( )
…….many others
Math and Trigonometry
= ACOS (x)
= ATAN2 (x,y)
= CEILING (x,n)
= COS (x)PI ( )
= DEGREES (x)
= EXP (X)
= FLOOR (x,n)
= LCM (x1, x2, x3,…)
= LOG10 (x)
= RADIANS (x)
= ROUNDUP (x,n)
= SIN (x)
= SINH (x)
= TAN (x)
= TRUNC (x,n)
…….many others
Statistics
= MIN (c1:d10)
= MAX (c1:d10)
= AVERAGE (c1:d10)
= MEDIAN (c1:d10)
= STDEV (c1:d10)
= VAR (c1:d10)
…….many others
Engineering
= BESSELI (x,n)
= CONVERT (x,from,to)
= ERF (lower,upper)
= DELTA (x1,x2)
= DEC2BIN(x,places)
= GESTEP (x,step)
= HEX2BIN(x,places)
= IMAGINARY (x,i)
= IMCONJUGATE (x)
= OCT2BIN (x,places)
= …….many others
Logical Functions
• If test:
= IF ( logical test, value if true, value if false )
• Example:
= IF (A10 >= B20,A10,0)
• Others: AND, NOT, OR
Interfacing to the World
• Open and Save (default format)
• Save As (choose format)
• Importing data
– Copy and paste
– Excel’s import wizard
• CSV
• HTML
• Text
• Excel/Word interfaces
Excel Part I Topics
•
•
•
•
•
Excel basics
Cell referencing
Math functions
Charts (plots) basics
Homework Assignment
Charts (Plots)
• Excel’s terminology:
– “Chart” (plot)
• Engineers commonly use XY scatter, not line!!
– “Category” is the independent variable,
horizontal axis, abscissa
– “Value” is the dependent variable, vertical
axis, ordinate
• Excel’s chart wizard (chart tab)
Graphing Standards
• Plotting
– Experimental data
• Data pairs (x,y)
– Theoretical curves
• An equation
• Axes scales
– Linear
– Range to show
– Semilog and log
• Labeling
– Axes names
– Units
• Multiple curves on
one set of axes
– Legends
– Line types
– Symbols (if needed)
Simple Plotting
Generate X and Y data to Plot
Common Types of Plots
Example: Y=3X2
350
300
Cartesian
250
Y
200
150
1000
100
log-log : log y-log x
50
0
0
2
4
6
8
10
X
350
logY
100
10
300
Semi-log : log x
250
1
200
Y
1
150
10
logX
100
50
0
1
10
logX
Homework Assignment #3
Problem 1 Compute Final Grade Totals
Using Excel compute final grade totals (based on 100) for 6
students with semester grades as shown below. Use percentages:
Exam 1&2 – 25% each; Homework – 20% and Final Exam – 30%.
Work this problem on Sheet 1 of your Excel spreadsheet, and
place your complete name on the first row.
Name
Exam 1
Exam 2
Homework Final Exam
Jim
76
82
70
83
Sally
78
88
90
85
Bob
80
85
80
95
Jen
86
92
90
95
Tim
70
84
85
80
Carla
81
85
70
88
Total
Homework Assignment #3
Problem 2 Computing and Plotting
Consider the motion of a baseball moving freely only under the
influence of gravity. If the baseball starts at the origin at time=0
with an initial velocity vo and angle , the horizontal and vertical
positions of the ball are given by the relations
1 2
s h  (vo cos )t , sv  (vo sin )t  gt
2
Also given for this problem is a set of experimental data (bb.txt) for
the positions sh and sv (in meters) that includes air resistance.
This data was collected for the case  = 25o but the initial velocity
was not recorded.
Homework Assignment #3
Problem 2 Continued 1. First cut and paste or use the import feature and move the data
from bb.txt into Sheet 2 of your Excel Spreadsheet. Then make
a plot of this data with sh on the horizontal axis and sv on the
vertical axis. Plot this using scatter symbols.
2. Next on the same Sheet compute the positions sh and sv using
the given theoretical relations using  = 25o but with a variable
initial velocity (use absolute referencing to an open cell). Plot
these results using scatter solid line. Using trial and error,
make several plotting attempts to closely match the
experimental data points.
3. Final plot should contain experimental data and theoretical
predictions, and include axes labels, legend and your complete
name in title (see example plot).
Homework Assignment #3
Problem 2 Example Plot
Homework Assignment #3
Problem 2 Continued – Submission Procedures
Submit your Excel Spreadsheet with each problem
work on Sheets 1 and 2 as an attachment to an email to
Prof. Sadd with the subject line egr105_3 (no spaces).
Due Date: October 10.
Download