introduction (spreadsheet, i.e. ms excel) · pdf file(spreadsheet, i.e. ms excel) '...

21
1 A. J. Clark School of Engineering Department of Civil and Environmental Engineering by Dr. Ibrahim A. Assakkaf Spring 2001 ENCE 203 - Computation Methods in Civil Engineering II Department of Civil and Environmental Engineering University of Maryland, College Park INTRODUCTION (Spreadsheet, i.e. MS Excel) ' Assakkaf Slide No. 1 A. J. Clark School of Engineering Department of Civil and Environmental Engineering ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel) High-level Languages vs. Spreadsheets, MATLAB & MathCad FORTRAN (introduced by IBM in 1957) FORTRAN = FORmula TRANslation Developed for the IBM 704 Computer Developed by John Backus and a team of 13 other programmers BASIC Pascal Others such as C and C++

Upload: nguyendung

Post on 28-Mar-2018

215 views

Category:

Documents


2 download

TRANSCRIPT

1

� A. J. Clark School of Engineering �Department of Civil and Environmental Engineering

by

Dr. Ibrahim A. AssakkafSpring 2001

ENCE 203 - Computation Methods in Civil Engineering IIDepartment of Civil and Environmental Engineering

University of Maryland, College Park

INTRODUCTION(Spreadsheet, i.e. MS Excel)

© Assakkaf

Slide No. 1

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN (introduced by IBM in 1957)� FORTRAN = FORmula TRANslation� Developed for the IBM 704 Computer� Developed by John Backus and a team of

13 other programmers� BASIC� Pascal� Others such as C and C++

2

© Assakkaf

Slide No. 2

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

� Software Packages� MATLAB� MathCad� Spreadsheet

� MS Excel� Quattro Pro� Lotus 123

High-level Languages vs. Spreadsheets, MATLAB & MathCad

© Assakkaf

Slide No. 3

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN� FORTRAN is a high-level language such

as BASIC, C, and C++� A compiler translates each statement in the

program into a sequence of basic machine language instruction

CBAX += *

3

© Assakkaf

Slide No. 4

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN

Compiler

Source Program(high level language)

Object Program(machine language)

© Assakkaf

Slide No. 5

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN� A FORTRAN program consists of

� Input� An execution logic (computation)� Output

� A flow chart is used to develop the structure

4

© Assakkaf

Slide No. 6

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN� EXAMPLE 1: Volume of a Cylinder

� Input� Diameter, D� Height, h

� Computation

� Output� Volume, V

hDV ×

=

4

© Assakkaf

Slide No. 7

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN� Flow Chart for the Example 1

A flow chart is a block diagram that summarizes the program structure and logic flow

BEGIN ENTER:D and h

CALCULATE:V

hDV

=

4

OUTPUT:Display

Volume(V)END

5

© Assakkaf

Slide No. 8

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN� EXAMPLE 2: Height of a Cylinder

� Input:� Diameter, D� Volume, V

� Computation

� Output:� Height, h

24DVh

π=

© Assakkaf

Slide No. 9

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN� Flow Chart for Example 2

BEGIN ENTER:D and V

CALCULATE:V

OUTPUT:Display

Height(h)END

24DVh

π=

6

© Assakkaf

Slide No. 10

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN� The following is a format of a simple

program:� PROGRAM NAME� Opening documentation use� Variables declaration� Program statements� END

© Assakkaf

Slide No. 11

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN Statements� Positions 7 to 72 of a line can be used. To

continue on the next line, use any character on position 6 of the next line

� Constants� Examples

� -12� 1.2345� 12.45-e10

7

© Assakkaf

Slide No. 12

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN

1 2 3 4 5 6 7 8 12345 6 7890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 C

Statement in columns 7 to 72

Statement labels in columns 1 to 5

Character different from 0 or blank in column 6Indicates a continuation of the preceding line

C or * in column 1 indicates a comment

Column 73And beyondAre ignored

© Assakkaf

Slide No. 13

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN� Data Types

� Integer� Real� Double Precision� Complex� Character� Logical

8

© Assakkaf

Slide No. 14

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� FORTRAN� This program calculates the velocity and

height of a projectile given its initial height, velocity,and constant acceleration

0

002

:Velocity21 :Height

vatv

htvath

+=

++=

© Assakkaf

Slide No. 15

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad� FORTRAN

PROGRAM PROJECT 1 7 12345 6 7890 C Th is program calculates the velocity and height of a projectile given its C initial height, initial velocity, and constant acceleration. Variables used are: C HGHT0 : initial height C HGHT : height at any time C VELOC0 : initial vertical velocity C VELOC : vertical velocity at any time C ACCEL : vertical acceleration (Gravity) C TIME : time elapsed since projectile was launched REAL HGHT0, HGHT, VELOC0, VELO, ACCEL, TIME ACCEL = -9.807 PRINT *, `Enter initial height, initial velocity, and time?` READ *, HGHT0, VELOC0, TIME HGHT = 0.5 * ACCEL * TIME ** 2 +VELOC0 * TIME + HGHT0 VELOC = ACCEL * TIME + VELOC0 PRINT *, `AT TIME `, TIME, ` THE VERTICAL VELOCITY IS `, VELOC PRINT *, `AND THE HEIGHT IS `, HGHT END

9

© Assakkaf

Slide No. 16

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� Spreadsheets� Spreadsheet is special type software that

allow the user to enter and perform calculations on rows and columns of data displayed on computer monitor.

� Advantages of Spreadsheet� Easy to use and understand� Provide organized record of user computation� Entire calculation can be updated easily� Suitable for �what if?� scenarios

© Assakkaf

Slide No. 17

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� Spreadsheet CalculationsB5 = B3 + B4

A B C D E F I123 X = 104 Y = 13.55 Sum = 23.5678 u = 459 v = 25

10 33.541021112

B10 = sqrt(B8*B9)

=uv

10

© Assakkaf

Slide No. 18

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� Spreadsheet� EXAMPLE 1: Volume of a Cylinder

� Input� Diameter, D� Height, h

� Computation

� Output� Volume, V

hDV ×

=

4

© Assakkaf

Slide No. 19

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� Spreadsheet (Example 1) B5 = B3 + B4

A B C D E F I12 Volume of Cylinder:3 X = 10 D = 20 in4 Y = 13.5 h = 76 in5 Sum = 23.5 Volume = 23876.1 in2

678 u = 459 v = 25

10 33.541021112

B10 = sqrt(B8*B9)(PI()*E3^2/4)*E4

=uv

11

© Assakkaf

Slide No. 20

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� Spreadsheet� EXAMPLE 2: Height of a Cylinder

� Input:� Diameter, D� Volume, V

� Computation

� Output:� Height, h

24DVh

π=

© Assakkaf

Slide No. 21

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� Spreadsheet (Example 2) B5 = B3 + B4

A B C D E F I12 Volume of Cylinder:3 X = 10 D = 20 in4 Y = 13.5 V = 23876.10417 in3

5 Sum = 23.5 h = 76 in678 u = 459 v = 2510 33.541021112

B10 = sqrt(B8*B9) E5 = (4*E4/(PI()*E3^2)))

=uv

12

© Assakkaf

Slide No. 22

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� Spreadsheet CalculationsA B C D E

1

2 Diameter, D Volume, VCalculated Height, h

3 2 300 95.492965864 4 450 35.80986225 6 600 21.220659086 8 750 14.920775917 10 900 11.45915598 12 1050 9.2840383479 14 1200 7.79534415110 16 1350 6.7143491621112

0

20

40

60

80

100

120

0 5 10 15 20

D

h

© Assakkaf

Slide No. 23

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

High-level Languages vs. Spreadsheets, MATLAB & MathCad

� Spreadsheet &Numerical Solutions

-10

0

10

20

30

-4 -3 -2 -1 0 1 2 3 4

x

y

0532 2 =−+= xxy

x y-3 4

-2.5 0-2 -3

-1.5 -5-1 -6

-0.5 -60 -5

0.5 -31 0

1.5 42 9

2.5 153 22

Roots

13

© Assakkaf

Slide No. 24

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

© Assakkaf

Slide No. 25

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

14

© Assakkaf

Slide No. 26

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

MS Excel Mathand Trig. functions

© Assakkaf

Slide No. 27

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

15

© Assakkaf

Slide No. 28

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

© Assakkaf

Slide No. 29

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

16

© Assakkaf

Slide No. 30

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

© Assakkaf

Slide No. 31

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

17

© Assakkaf

Slide No. 32

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

© Assakkaf

Slide No. 33

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

18

© Assakkaf

Slide No. 34

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

© Assakkaf

Slide No. 35

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

19

© Assakkaf

Slide No. 36

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

© Assakkaf

Slide No. 37

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

20

© Assakkaf

Slide No. 38

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

© Assakkaf

Slide No. 39

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

21

© Assakkaf

Slide No. 40

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel

© Assakkaf

Slide No. 41

� A. J. Clark School of Engineering � Department of Civil and Environmental Engineering

ENCE 203 - INTRODUCTION - Spreadsheets (Microsoft Excel)

Introduction to MS Excel