EF105

advertisement
WELCOME
EF 105
Fall 2006
EF 105
Computer Methods in Engineering
Problem Solving
Week07: Trig Review and Charts
Use of EXCEL
Learning Objectives
Learn more about functions
Learn how to use Trigonometry functions
Learn to use tables and graphs as problem
solving tools
Learn and apply different types of graphs
and scales
Prepare graphs in Excel
Be able to edit graphs
Use Excel’s functions
Functions TAKE arguments
Functions RETURN values
y  f ( x1 , x2 ,..xn )
You can easily calculate the sum, average, count, etc. of a large
number of cells by using a function.
A function is a predefined, or built-in, formula for a commonly
used calculation.
Each Excel function has a name and syntax.
 The syntax specifies the order in which you must enter
the different parts of the function and the location in which
you must insert commas, parentheses, and other
punctuation
 Arguments are numbers, text, or cell references used by
the function to calculate a value
 Some arguments are optional
Work with the Insert Function button
Excel supplies more than 350 functions
organized into 10 categories:

Database, Date and Time, Engineering, Financial,
Information, Logical, Lookup, Math, Text and Data,
and Statistical functions
You can use the Insert Function button on the
Formula bar to select from a list of functions.
A series of dialog boxes will assist you in filling
in the arguments of the function and this
process also enforces the use of proper syntax.
Anatomy of Excel Functions
=FUNCTION(argument1,argument2,..,argumentN,…)
Name
Mandatory 1..N-1
optional
Define functions, and
functions within functions
The SUM function is a very commonly used math
function in Excel.
A basic formula example to add up a small number of
cells is =A1+A2+A3+A4, but that method would be
cumbersome if there were 100 cells to add up.
Use Excel's SUM function to total the values in a range of
cells like this: SUM(A1:A100).
You can also use functions within functions. Consider the
expression =ROUND(AVERAGE(A1:A100),1).

This expression would first compute the average of all the
values from cell A1 through A100 and then round that result
to 1 digit to the right of the decimal point
Open the Insert Function dialog box
To get help from Excel to insert a function, first
click the cell in which you wish to insert the
function.
Click the Insert Function button. This action will
open the Insert Function dialog box.
If you do not see the Insert Function button,
you may need to select the appropriate toolbar
or add the button to an existing toolbar.
Examine the Insert Function
dialog box
This dialog box appears when you click the Insert Function
button. It can assist you in defining your function.
Use the Insert Function dialog box to enter function
arguments
This figure depicts how you would enter argument values
for the PMT function using the Insert Function dialog box.
Recognize optional arguments
In the preceding figure, note how rate and nper
are arguments for each function.
For some of the functions, the final two
arguments of each function are in brackets. These
represent optional arguments, meaning if you do
not enter anything, the default values for these
arguments will be used.

For example, note the PMT function has fv and type
as its final two arguments, which are optional. The
assumed values, if no others are supplied, are 0 for
both
Arguments without brackets do not have default
values, so you must supply values or cell
references in order for the function to be able to
return a value.
Create logical functions
A function that determines whether a condition is true or
false is called a logical function.
Excel supports several logical functions such as AND,
FALSE, IF, NOT, OR and TRUE.
A very common function is the IF function, which uses a
logical test to determine whether an expression is true
or false, and then returns one value if true or another
value if false.
The logical test is constructed using a comparison
operator that compares two expressions to determine if
they are equal, not equal, if one is greater than the
other, and so forth.

The comparison operators are =, >, >=, <, <=, and <>
You can also make comparisons with text strings. You
Using the If function
The arguments for the IF function are:
 IF(logical_test,value_if_true,value_if_false)
 For example, the function =IF(A1=10,20,30) tests
whether the value in cell A1 is equal to 10
 If it is, the function returns the value 20, otherwise the
function returns the value 30
 Cell A1 could be empty or contain anything else besides
the value 10 and the logical test would be false;
therefore, the function returns the value 30
To insert an IF function, click the Insert Function button and
search for the IF function, then click OK.
When the Function Arguments dialog box appears, simply fill
in the arguments.
The TODAY and Now functions
The TODAY and NOW functions always display the
current date and time.
You will not normally see the time portion unless you
have formatted the cell to display it.
If you use the TODAY or NOW function in a cell, the
date in the cell is updated to reflect the current date
and time of your computer each time you open the
workbook.
Let’s open your saved workbooks from
last class and add a logical and a date
function!
Use a formula to enter the date
If you wanted a fixed date to remain in a cell , you would enter that date. If you
wanted the date in this cell to always reflect the current date and time when you
opened the workbook, you would use the expression =NOW() or =TODAY() as
shown in the formula bar in the figure.
TRIGONOMETRY FUNCTIONS
When solving trigonometric expressions like sine, cosine and tangent, it
is very important to realize that Excel uses radians, not degrees to
perform these calculations! If the angle is in degrees you must first
convert it to radians.
There are two easy ways to do this.
1.Recall that p = 180°. Therefore, if the angle is in degrees, multiply
it by p/180° to convert it to radians. With Excel, this conversion can
be written PI( )/180. For example, to convert 45° to radians, the
Excel expression would be 45*PI( )/180 which equals 0.7854
radians.
2.Excel has a built-in function known as RADIANS(angle) where
angle is the angle in degrees you wish to convert to radians. For
example, the Excel expression used to convert 270° to radians
would be RADIANS(270) which equals 4.712389 radians
TRIGONOMETRY FUNCTIONS
You can use the DEGREES(angle) function to convert
radians into degrees. For example, DEGREES(PI( ) ) equals
180.
Excel uses several built-in trig functions. Those that you will
use most often are displayed in the table below. Note that the
arguments for the SIN( ), COS( ) and TAN( ) functions are,
by default, radians. Also, the functions ASIN( ), ACOS( ) and
ATAN( ) return values in terms of radians. (When working
with degrees, you will need to properly use the DEGREES( )
and RADIANS( ) functions to convert to the correct unit.)
TRIGONOMETRY FUNCTIONS
Mathematical
Expression
sine: sin()
Excel
Expression
SIN(number)
Excel Examples
SIN(30) equals -0.98803, the sine of 30 radians
SIN(RADIANS(30)) equals 0.5, the sine of 30°
cosine: cos()
COS(number)
COS(1.5) equals 0.07074, the cosine of 1.5 radians
COS(RADIANS(1.5)) equals 0.99966, the sine of 1.5°
tangent: tan()
TAN(number)
TAN(2) equals -2.18504, the tangent of 2 radians
TAN(RADIANS(2)) equals 0.03492, the tangent of 2°
arcsine: sin-1(x)
ASIN(number)
ASIN(0.5) equals 0.523599 radians
DEGREES(ASIN(0.5)) equals 30°, the arcsine of 0.5
arccos: cos-1(x)
ACOS(number)
ACOS(-0.5) equals 2.09440 radians
DEGREES(ACOS(-0.5)) equals 120°, the arccosine of 0.5
arctangent: tan1
(x)
ATAN(number)
ATAN(1) equals 0.785398 radians
DEGREES(ATAN(1)) equals 45°, the arctangent of 1
TRIGONOMETRY FUNCTIONS: Example 1
(Make these on a “TRIG”
sheet of your workbook.)
Say, for instance, we want to know
the height of the tree in the figure .
We know that if we stand 76 m from
the base of the tree (x = 76 m) the
line of sight to the top of the tree is
32° with respect to the horizon ( =
32°). We know that
Solving for the height of the tree, h,
we find
TRIGONOMETRY FUNCTIONS: Example 2
In this next example, we wish to know the
launch angle, a, of the water ski ramp
shown. We are given that A = 3.5 m, B =
10.2 m and b = 45.0°. To find a, we can use
the Law of Sines which, in this case can
be written
We can rewrite this equation as a using the
equation
The screen shot below shows how we used
Excel to determine that the launch angle of
the ramp is 14.04°.
TRIGONOMETRY FUNCTIONS: Example #3
In our final trigonometry example, we will use Excel to examine the trig
identity
Notice in the screen shot below that this identity holds true when  is
given in radians and degrees.
Note the units for the angle  are placed in different cells than the
numbers. If we place the numbers and the units in the same cell, Excel
will not be able to decipher the number and therefore we will not be able
to reference the cells for use in any equation!
Proper Use of Tables & Graphs
(Make these on a “TCG” sheet of your workbook.)
Height
H (m)
0
300
Temp
T (C)
15.0
12.8
Pressure
P (kPa)
101.3
97.7
11.1
94.2
Temperature (C)
600
16
160
14
140
12
120
10
100
8
80
6
Temp
60
4
Pressure
40
2
20
0
0
500
Height (m)
1000
0
1500
Pressure (kPa)
Engineers record
and present data
in two primary
formats: Tables
and Graphs
Tables
Tables should always have:


Title
Column headings with brief descriptive name,
symbol and appropriate units.
Numerical data in the table should be written to
the proper number of significant digits.

The decimal points in a column should be aligned.
Tables should always be referenced and
discussed (at least briefly) in the body of the
text of the document containing the table.
Table Example
Temperature and Pressure of
Widgets at Various Heights
Height
H (m)
0
300
600
Temp
T (C)
15.0
12.8
11.1
Pressure
P (kPa)
101.3
97.7
94.2
Exercise
Enter the following table in Excel (Label a
sheet in the workbook you’ve been using in
class.)
Independent Dependent Dependent
Variable, x Variable, y1 Variable, y2
1
1
1
2500
5000
10
100
50
100
7500
1000
150
10000
10000
200
You can make your tables look nice by
formatting text and borders
Graphs
Proper graphing of data involves several
steps:




Select appropriate graph type
Select scale and gradation of axes, and
completely label axes
Plot data points, then plot or fit curves
Add titles, notes, and or legend
Graphs - Types
2. Bar Graph
1. Pie Chart
Travel Expenses
Travel Expenses
Motel
Gas
18
16
14
12
10
8
6
4
2
0
Food
Gas
44%
Food
31%
Expenses ($)
Motel
26%
Graphs - Types
3. 3-D Graph
5
4
3
8
7
6
2
5
4
1 14
3
12 10
2
8 6
1
4 2
0 0
16
160
14
140
12
120
10
100
8
80
6
Temp
60
4
Pressure
40
2
20
0
0
500
Height (m)
1000
0
1500
Pressure (kPa)
6
Object 1
Object 2
Temperature (C)
7
4. Line Graph
Graphs
Each graph must include:



A descriptive title which provides a clear and
concise statement of the information being
presented
A legend defining point symbols or line types used
for curves needs to be included
Labeled axes
Graphs should always be referenced/discussed
in the body of the text of the document
containing the table.
Titles and Legends
Each graph must be identified with a
descriptive title
The title should include clear and concise
statement of the information being
presented
A legend defining point symbols or line
types used for curves needs to be included
Axis Labels
Each axis must be labeled
The axis label should contain the name of
the variable and its units.
The units can be enclosed in parentheses,
or separated from the label by a comma.
Length (km)
Gradation
Scale gradations should be selected so
that the smallest division of the axis is an
integer power of 10 times 1, 2, or 5.
Exception is units of time.
Scale Graduations,
Smallest Division=3.33
Scale Graduations,
Smallest Division=1
0
10
20
Acceptable
30
0
10
20
Not Acceptable
30
Data Points and Curves
Data Points are plotted using symbols


The symbol size must be large enough to easily
distinguish them
A different symbol is used for each data set
Data Points are often connected with lines

A different line style is often used for each data
set
Example
Velocity of Three Runners
During a 5 km Race
10
9
Runner #1
Runner # 2
Runner # 3
8
Velocity (m/s)
7
6
5
4
3
2
1
0
0
1
2
3
4
5
Distance (Km)
The variability in the speed maitained by each of the three
Building a Graph In Excel
Select the data that you want to include in the
chart by dragging through it with the mouse.
Then click the Chart Wizard
Building the Graph
Choose XY
(Scatter), with
data connected
by lines if
desired.
Click “Next”
Building the Graph
Make sure that the
series is listed in
columns, since your
data is presented in
columns.
Click the Series tab to
enter a name for the
data set, if desired.
Choose “Next”
Building the Graph
Fill in Title and Axis information
“Next”
Building a Chart
Select “As new sheet” to create the chart on it’s
own sheet in your Excel file, or “As object in” to
create the chart on an existing sheet
“Finish”
Creating a Secondary Axis
This is useful when the data sets cover very
different ranges.
Right click on the line (data
series) on the chart that you
want to associate with a
secondary axis.
Select “format data series”
Select the Axis tab, then
“Plot series on secondary
axis” as shown.
“OK”
Editing/Adding Labels
Now you can go back to the “chart options” to add labels
 Click the chart in a blank area, then either right click and select chart
options or choose chart options from the “Chart” menu
Fill in or edit the
axes labels, title,
etc.
Click “OK”
Result
A Baseball Problem
(Make these on a “Baseball” sheet of your workbook.)
A runner is on 3rd base, 90 ft from home plate. He can
run with an average speed of 27 ft/s. A ball is hit to the
center fielder who catches it 310 ft from home plate.
The center fielder can throw the ball no faster than 110
ft/s. The runner tags up and runs for home plate.
 Can the center fielder throw him out? To do so, he
must get the ball to the catcher at an appropriate
height before the runner can get to home plate.
 If so, at what angle and what velocity does he
need to throw the ball in order to put the runner
out?
Graphic Translation
 ft 
r (t )  vt   27 t
 s
Runner
90 ft
V0
Center Fielder
1 2 

y(t )  V0 sin( )t  gt  j
2



j


i

x(t )  V0 cos( )t i
310 ft
Solving with Excel-Iteration Method
Open an Excel
spreadsheet and
create column heads
like the example.
Rows 1 - 6 are for
constants. Remember
to use the $ notation
when reference
absolute address
Solutions - Building a Table
Rows 7 and above can be used
to calculate the x and y
positions at different times t
using the formula for projectile
motion. For example, under
x(t) in Cell B8 enter the
formula:
= $B$4*cos($C$2)*A8
What formula would be
entered for y(t) (height)and
r(t) (runner position)?
Is there an easy way to enter
the values for time beginning
in Cell A8?
Solution - iterations
Notice how changing
Cell B2 effects the rest
of the spreadsheet,
especially x(t) and y(t)
columns.
By watching the results
in those columns, you
can get arbitrarily close
to 310 and 0. Also Cell
B4 can be changed for
even finer tuning.
Solution - Using a Chart
Another way to solve this problem is with
a graph. This method will use the data
generated on the previous slides but will
use a chart to show the result.
The next slide shows a completed chart.
Notice that the line shows the ball position
reaches 310 ft before the runner has
traveled 90 ft.
Building a Chart
(Step 1)

Select the data that
you want to include in
the chart by dragging
through it with the
mouse.
Building a Chart (Step 2)

click the chart wizard.
Building a Chart (Step 3)


Choose XY (Scatter)
Then choose “Next”
Building a Chart (Step 4)
Make sure that the
series is listed in
columns.
Choose “Next”
Building a Chart (Step 5)


Fill in Title and Axis
information
“Next”
Building a Chart (Step 6)
Choose “As new sheet”, then “Finish”
Building a Chart (Step 7)
Creating a Secondary
axis.



Right click on the data
series that you want to
associate with a
secondary axis.
Right click and choose
“format data series.
Select “Plot series on
secondary axis”
Building a Chart (Step 8)
Select “Chart”, then
“Chart Options”
Fill in the title for
secondary value (Y)
axis.
Click “OK”
This should complete
the chart.
Using Solver
Select and copy the
first 8 rows of the first
4 columns of the
spread sheet.
Remember that Row 8
contains the formulas
for calculating the x, y
and r positions.
Using Solver
Select another
worksheet from the
bottom of the
spreadsheet
Right click on its label
and rename if desired.
Select Cell A1
Paste.
Using Solver
Pull down Tools, then
select solver.
Set Target Cell
Desired Value
Manipulated
Cells
Constraints
Select Solve
Using Solver
Solver arrives at a
solution that is within
the constraints.
 = 28.31 degrees
V0 = 110 ft/s
t = 3.20 seconds.
The ball is at home plate
two feet off the ground
while the runner is still
3.58 feet away.
Helpful Hint
Note that any cell can be
assigned a name. This can
be done by first clicking on
the cell (say B4) and then
typing the name in the
name box (above the
column A label). This can
be very useful when that
cell is used as an absolute
address.
Helpful Hint
The name can then be
used when typing
formulas. This creates a
formula that looks more
like the actual equation
making it easier to type
and to verify. In this
example the cell names,
Vo_solver, theta_solver,
and time were used
instead of $B$4, $C$2,
$A$8.
Next,
1. Do the Tutorial, Part 2
on your own
2. Solve the following on your own:
A. What is the length of horizontal base of the triangle? (cm)
B. What is the area of this triangle? (sq. cm)
Download