Civil & Environmental Engineering Department: King Fahd University of Petroleum & Minerals
Civil & Environmental Engineering Department: King Fahd University of Petroleum & Minerals
1
Mark
ID #
Submission Date
Problem 1
Problem 2
Problem 3
Problem 4
Total
Student Name
Problem #
King Fahd University of Petroleum & Minerals
Civil & Environmental Engineering Department
CE 318 Numerical & Statistical Methods in Civil Engineering
Academic Term
Assignment #
Instructor: Dr. Husain Jubran Al-Gahtani
How to use Excel built-in functions
Exercise 1
Fill-in the third column by computing the respective function given in the second column
x Formula Result
-1 Abs(x)
3.14 Cos(x)
3.14 Sin(x)
pi()
0.1 Exp(x)
2.5 Even(x)
2.5 Odd(x)
2.35 Floor(x,a)
2.35 Ceiling(x,a)
16 Sqrt(x)
0.5 Atan(x)
180 Radians
As an example, to use the "SIN" formula just write =(equal to) SIN followed by the number in brackets
as shown in the figure. As soon as you close the brackets and hit enter the formula is evaluated and
displayed in the same cell as shown in the figure. Note that you can use capital, small or mixed letters
(Excel is not case-sensitive)
Try more functions (many of them stored under "Formulas" menue
Repeating Calculations
Create a table in which the first column is x, the second column is f(x) = x
2
+sin x +e
x
Repeat the caculations for x = 0.1, 0.2 to 1.2, then plot the data of x versus f(x)
Add a third column containing the function x*f(x) to the data and add it to the plot
x f(x) x*f(x)
0.1 1.2150043 0.001215
0.2 1.4600721 0.292014
0.3 1.735379 0.520614
0.4 2.041243 0.816497
0.5 2.3781468 1.189073
0.6 2.7467613 1.648057
0.7 3.1479704 2.203579
0.8 3.582897 2.866318
0.9 4.05293 3.647637
1 4.5597528 4.559753
1.1 5.1053734 5.615911
1.2 5.692156 6.830587
Exercise 2
-8 0 < x < 4
V(x)= 12 6 < x< 8
42-5x 8 < x< 10
-8x 0 < x < 4
M(x) 12x-80 6 < x< 8
-2.5x^2+42x-170 8 < x< 10
x (m) V (N) M (N.m)
0 -8 0
4 -8 -32
4.001 12 -31.988
6 12 -8
7 7 1.5
8 2 6
9 -3 5.5
10 -8 0
The first column in the following table represents distance measured from the left end of a beam.
The second column represents the shear force and the third represents the bending moment. Add
another two columns that display the results of V and M, then plot them in one figure (x-axis the
distance x and y-axis for shear V & moment M). Can you add a y-axis for the moment so that it has a
more suitable scale. (Hint:right mouse-click on the moment curve -> Format data series -> select
Soon (in this lab) you will learn a more efficient way of formulating the shear and moment using
"IF" statement
0
1
2
3
4
5
6
7
8
0 0.5 1 1.5
f(x)
x*f(x)
You should get the following results
-35
-30
-25
-20
-15
-10
-5
0
5
10
15
0 5 10 15
Shear (N)
Bending Moment
(N.m)
-35
-30
-25
-20
-15
-10
-5
0
5
10
-10
-5
0
5
10
15
0 5 10 15
Shear (N)
Bending Moment
(N.m)
Single IF if (logical statement, value if true, value if false)
Example1: If x > 3 then y=1, otherwise y = 0
x y
0 0
1 0
2 0
3 0
4 1
5 1
x y
0 Not greater than 3
1 Not greater than 3
2 Not greater than 3
3 Not greater than 3
4 Greater than 3
5 Greater than 3
Multiple If
Example 3 : Consider the function f(x) defined by:
4 x < 2
f(x) = 4-(x-2)
2
2 x 3
3 x > 3
Create a table in which the first column is x, the second column is f(x)
Repeat the caculations for x = 0,0.5, ... 4, then plot the data of x versus f(x)
x f(x)
0 4
0.5 4
1 4
1.5 4
2 4
2.5 3.75
3 3
3.5 3
4 3
Example 2: If x > 3 then assign to y the word "Greater than 3", otherwise assign the word
"Not greater than 3"
Example 4:Assign letter grades according to the following ranges
A 90
80 B < 90
70 C < 80
60 D < 70
F < 60
Use the following formula to complete the third column
Formula
Name Mark Grade
Ali 100.0 A
samir 39.0 F
Hassan 77.1 C
Nasir 85.8 B
Fahad 64.0 D
Rashid 90.0 A
Saad 61.0 D
Khalid 80.0 B
Omar 79.0 C
Ahmad 89.0 B
IF Combined with "OR" and "AND"
How "OR" and "AND work:
A given number Results
1 TRUE
10 FALSE
2.00 TRUE
0.50 FALSE
A given
number
Results
10 within 1-10
12 not within 1-10 =IF(OR(A84<1,A84>10),"not within 1-10","within 1-10")
=AND(b76>0,b76<10
=AND(b77>0,b77<10
Formula
=IF(B60<60,"F",IF(B60<70,"D",IF(B60<80,"C",IF(B60<90,"B","A")))
Formula
=IF(OR(A83<1,A83>10),"not within 1-10","within 1-10")
=OR(b78>1,b78<-1)
=OR(b79>1,b79<-1)
Assign the names in the first column to the values in the second column
(Procedure: highlight the cells A3:B10, Formulas-> Name Manager -> Create from selection -> check left column)
a 1
b 3
x -5
e 7
A 0 what went wrong?
a1 2 Why it did not accept the name a1
D 11
T 21 Is there another usage of T?
Find a*b/D+x
-4.72727
Names the following two matrices as M1_ and M2_, then get their dot product
5 2 1 0 (highlight the cells A21:B22, Formulas-> Define Name -> type: M1_). Do the same for M2_
3 4 3 1
M1_.M2_ 11 2 (highlight the cells B25:C26, type: =mmult(M1_,M2_) then click Shift+Ctrl+Enter)
15 4
(Procedure: highlight the cells A3:B10, Formulas-> Name Manager -> Create from selection -> check left column)
(highlight the cells A21:B22, Formulas-> Define Name -> type: M1_). Do the same for M2_
(highlight the cells B25:C26, type: =mmult(M1_,M2_) then click Shift+Ctrl+Enter)
Example 1: Use "VLOOKUP" to assign letter grades according to the following ranges
From To Grade
0 59 F Given
60 69 D Calculated
70 79 C
80 89 B
90 100 A
Name Mark Grade
Ali 70 C
samir 39 F
Hassan 77 C
Nasir 86 B
Fahad 64 D
Rashid 90 A
Saad 61 D
Khalid 80 B
Omar 79 C
Ahmad 60 D
Example 2: How many steel bars are needed?
Bar Dia. Area
(mm) (mm2)
6 28.3
8 50
10 79
12 113
14 154
16 201
18 254
20 314
22 381
25 491
28 616
32 804
36 1020
40 1260
1200 mm
2
Given
10 mm Calculated
79 mm
2
15.18987 bars
No. of Bars 16 bars
1264 mm
2
Area of steel (provided)
Bar diam
No. of Bars
Area of steel (required)
Bar area
Lab # 1
1 Built-in Functions & Repeated Calculations
2 Conditional Statements
3 Naming cells & Ranges
4 Look-up function
Problem 1 (Problem 2.21, textbook)
Use Excel to generate a 5th column for computing the velocity of water for the five
rectangular open channels
Civil & Environmental Engineering Department
CE 318 Numerical & Statistical Methods in Civil Engineering
Objectives: to give hands-on training on the following excel tools
Advanced Tools in Excel
Problem 2 (Textbook problem 2.22)
x < x- 0 >
4
< x- 5 >
4
< x- 7 >
2
< x- 8 >
3
uy
0
5
7
8
10
Hint: Use " If " function to generate the following table, then use the first and last
column to plot uy
Use Excel to construct uy, then plot uy versus x
Min. Mark Max. Mark Grade Rating
0 59 F Fail
60 64 D Poor
65 69 D+ Below Average
70 74 C Average
75 79 C+ Above Average
80 84 B Good
85 89 B+ Very Good
90 94 A Excellent
95 100 A+ Distinguished
Mark
Letter
Grade
Rating
69
84
91
59
75
78
93
81
66
Use "VLOOKUP" to assign a letter grade in the second column and a qualitative
rating in the third column of the following table
Problem 3: Given the following grading scale