Top Banner
Advanced Mathematical Methods for Civil Engineering Applications Wonsiri Punurai, PhD Wonsiri Punurai, PhD Department of Civil Engineering Room 6391, EG Building 3 Faculty of Engineering, Mahidol University Personal Web: www.egmu.net/~civil/wonsiri
40
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Matlab Lecture

Advanced Mathematical Methods for Civil Engineering Applications

Wonsiri Punurai, PhDWonsiri Punurai, PhD

Department of Civil EngineeringRoom 6391, EG Building 3

Faculty of Engineering, Mahidol UniversityPersonal Web: www.egmu.net/~civil/wonsiri

Page 2: Matlab Lecture

Course Information

Introduction to computer applications in civil engineering. Emphasis on analysis, mathematical problem-solving skills with computer tools and hand techniques.

Page 3: Matlab Lecture

Course Goals

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

Page 4: Matlab Lecture

Conduct of Course

Homework/Projects/Quizzes 30 %

Midterm Exam 30 %

Final Exam 40 %

Page 5: Matlab Lecture

Warnings!!

Participation expected, check by quizzesStudy in groups but submit work on your ownNo Copying of Matlab codeSubmit Homework at the beginning of classLate homework with penaltyNo make up quizzes or exams

Page 6: Matlab Lecture

Computers as engineering tools

Productivity– One engineer can do the work for “many”.

Precision– If use properly computers offer solutions to many

engineering problemsBetter communication– Visualization

Page 7: Matlab Lecture

Lecture I- Introduction to MATLAB

Page 8: Matlab Lecture

What is MATLAB?

Reference: www.mathworks.com

Page 9: Matlab Lecture

MATLAB 101

Getting Started ( เริ่มแรกเขาโปรแกรม )

Basic Arithmetic ( คําสั่งที่ใชในการคํานวณทางคณิตศาสตร )

Built-in Functions ( คําสั่งทางคณิตศาสตรที่มากับโปรแกรม )

Built-in Variables ( ลักษณะของตัวแปรที่มากับโปรแกรม )

Page 10: Matlab Lecture

Getting Started

MATLAB101MATLAB101MATLAB101---Getting StartedGetting StartedGetting Started

Page 11: Matlab Lecture

Launch Pad

Command Window

Command History

MATLAB101MATLAB101MATLAB101---Getting StartedGetting StartedGetting Started

Page 12: Matlab Lecture

MATLAB101MATLAB101MATLAB101---Getting StartedGetting StartedGetting Started

Page 13: Matlab Lecture

MATLAB101MATLAB101MATLAB101---Getting StartedGetting StartedGetting Started

Page 14: Matlab Lecture

MATLAB101MATLAB101MATLAB101---Getting StartedGetting StartedGetting Started

Page 15: Matlab Lecture

MATLAB101MATLAB101MATLAB101---Getting StartedGetting StartedGetting Started

Page 16: Matlab Lecture

MATLAB101MATLAB101MATLAB101---Getting StartedGetting StartedGetting Started

Page 17: Matlab Lecture

Basic Arithmetic

Calculator functions work as you’d expect:

+ and - are addition, / is division, * is multiplication, ^ is an exponent.

MATLAB101MATLAB101MATLAB101---Basic ArithmeticBasic ArithmeticBasic Arithmetic

Page 18: Matlab Lecture

Basic Arithmetic (cont.)

MATLAB101MATLAB101MATLAB101---Basic ArithmeticBasic ArithmeticBasic Arithmetic

Page 19: Matlab Lecture

MATLAB101MATLAB101MATLAB101---Basic ArithmeticBasic ArithmeticBasic Arithmetic

Page 20: Matlab Lecture

MATLAB101MATLAB101MATLAB101---Basic ArithmeticBasic ArithmeticBasic Arithmetic

Page 21: Matlab Lecture

MATLAB101MATLAB101MATLAB101---Basic ArithmeticBasic ArithmeticBasic Arithmetic

Page 22: Matlab Lecture

MATLAB 102

Array/Matrix ( เมตริกซ )

How to save & load data ( การเรียกใชและบันทึกขอมลู )

Low level input & output

Graphics

Page 23: Matlab Lecture

Array/Matrix

A matrix is a rectangular array of numbers.Scalars = 1x1 matricesVectors = row x column matrices

LetLet’’s try create a matrix s try create a matrix ““AA”” here!!here!!

MATLAB102MATLAB102MATLAB102---ArrayArrayArray

Page 24: Matlab Lecture

Steps to create a matrix

Separate the elements of a row with blanks or commas.

Use a semicolon, ; , to indicate the end of each row.

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

MATLAB102MATLAB102MATLAB102---ArrayArrayArray

To check array dimension (no. of rows and columns) use a commandTo check array dimension (no. of rows and columns) use a command ““whoswhos””

Page 25: Matlab Lecture

MATLAB102MATLAB102MATLAB102---ArrayArrayArray

Page 26: Matlab Lecture

MATLAB102MATLAB102MATLAB102---ArrayArrayArray

Page 27: Matlab Lecture

MATLAB102MATLAB102MATLAB102---ArrayArrayArray

Page 28: Matlab Lecture

MATLAB102MATLAB102MATLAB102---ArrayArrayArray

Page 29: Matlab Lecture

MATLAB102MATLAB102MATLAB102---ArrayArrayArray

Page 30: Matlab Lecture

Quiz I

Compute Y = Ab;

Solution

MATLAB102MATLAB102MATLAB102---ArrayArrayArray

Page 31: Matlab Lecture

Save & Load Data

MATLAB102MATLAB102MATLAB102---Save/Load DataSave/Load DataSave/Load Data

Page 32: Matlab Lecture

MATLAB102MATLAB102MATLAB102---In/OutputIn/OutputIn/Output

Input/Output Functions

Page 33: Matlab Lecture

MATLAB102MATLAB102MATLAB102---In/OutputIn/OutputIn/Output

Page 34: Matlab Lecture

Graphics

First, making a window for graphics output by typing

Simply type “plot” in command window.The plot function has different forms, depending on input arguments.

Page 35: Matlab Lecture

Graphics (cont.)

Page 36: Matlab Lecture

Graphics – create multiple data sets in one graph

MATLAB has ability to create multiple graphs.

Page 37: Matlab Lecture

Graphics – specify line styles and colors

LetLet’’s try this!!s try this!!

Page 38: Matlab Lecture

Graphics – multiple plots in one figure

Page 39: Matlab Lecture

barplot loglog plot

semilog plot

Graphics – plotting examples

stair plot

Page 40: Matlab Lecture

Quiz II

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!!