You are on page 1of 40

## Department of Civil Engineering

Room 6391, EG Building 3
Faculty of Engineering, Mahidol University
Personal Web: www.egmu.net/~civil/wonsiri

Course Information
z
z

## Introduction to computer applications in civil

engineering.
Emphasis on analysis, mathematical
problem-solving skills with computer tools
and hand techniques.

Course Goals
At the end of this course, students will be able to
z Use, create, and modify scripts in MATLAB
(and probably spreadsheets in MS EXCEL) to
solve quantitative simple problems in future
classes.
z Prepare oral + written presentations in class

Conduct of Course
z

Homework/Projects/Quizzes

Midterm Exam

Final Exam

30 %
30 %
40 %

Warnings!!
z
z
z
z
z
z

## Participation expected, check by quizzes

Study in groups but submit work on your own
No Copying of Matlab code
Submit Homework at the beginning of class
Late homework with penalty
No make up quizzes or exams

z

Productivity

Precision

## One engineer can do the work for many.

If use properly computers offer solutions to many
engineering problems

Better communication

Visualization

## Lecture I- Introduction to MATLAB

What is MATLAB?

Reference: www.mathworks.com

MATLAB 101
z

Getting Started ( )

Basic Arithmetic ( )

Built-in Functions ( )

Built-in Variables ( )

Getting Started

MATLAB101
MATLAB101--Getting
Getting Started
Started

Command
Window

Command
History

MATLAB101
MATLAB101--Getting
Getting Started
Started

MATLAB101
MATLAB101--Getting
Getting Started
Started

MATLAB101
MATLAB101--Getting
Getting Started
Started

MATLAB101
MATLAB101--Getting
Getting Started
Started

MATLAB101
MATLAB101--Getting
Getting Started
Started

MATLAB101
MATLAB101--Getting
Getting Started
Started

Basic Arithmetic
z

MATLAB101
MATLAB101--Basic
Basic Arithmetic
Arithmetic

MATLAB101
MATLAB101--Basic
Basic Arithmetic
Arithmetic

MATLAB101
MATLAB101--Basic
Basic Arithmetic
Arithmetic

MATLAB101
MATLAB101--Basic
Basic Arithmetic
Arithmetic

MATLAB101
MATLAB101--Basic
Basic Arithmetic
Arithmetic

MATLAB 102
z

Array/Matrix ( )

Graphics

Array/Matrix
z

## A matrix is a rectangular array of numbers.

Scalars = 1x1 matrices
Vectors = row x column matrices

MATLAB102
MATLAB102--Array
Array

z

## Surround the entire list of elements with square brackets, [ ] .

To check array dimension (no. of rows and columns) use a command whos

MATLAB102
MATLAB102--Array
Array

MATLAB102
MATLAB102--Array
Array

MATLAB102
MATLAB102--Array
Array

MATLAB102
MATLAB102--Array
Array

MATLAB102
MATLAB102--Array
Array

MATLAB102
MATLAB102--Array
Array

Quiz I

; Compute Y = Ab

Solution

MATLAB102
MATLAB102--Array
Array

MATLAB102
Data

Input/Output Functions

MATLAB102
MATLAB102--In/Output
In/Output

MATLAB102
MATLAB102--In/Output
In/Output

Graphics
z

typing

## Simply type plot in command window.

The plot function has different forms,
depending on input arguments.

Graphics (cont.)

z

semilog plot

barplot

stair plot

loglog plot

Quiz II
z

## Given y =sin (x1.8) where 0<x<0.5 and x increments every 0.05,

try plotting graph between x and y values now!!