Matlab Lecture
description
Transcript of 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
Course Information
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 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
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
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
MATLAB 101
Getting Started ( เริ่มแรกเขาโปรแกรม )
Basic Arithmetic ( คําสั่งที่ใชในการคํานวณทางคณิตศาสตร )
Built-in Functions ( คําสั่งทางคณิตศาสตรที่มากับโปรแกรม )
Built-in Variables ( ลักษณะของตัวแปรที่มากับโปรแกรม )
Launch Pad
Command Window
Command History
MATLAB101MATLAB101MATLAB101---Getting StartedGetting StartedGetting Started
Basic Arithmetic
Calculator functions work as you’d expect:
+ and - are addition, / is division, * is multiplication, ^ is an exponent.
MATLAB101MATLAB101MATLAB101---Basic ArithmeticBasic ArithmeticBasic Arithmetic
Basic Arithmetic (cont.)
MATLAB101MATLAB101MATLAB101---Basic ArithmeticBasic ArithmeticBasic Arithmetic
MATLAB 102
Array/Matrix ( เมตริกซ )
How to save & load data ( การเรียกใชและบันทึกขอมลู )
Low level input & output
Graphics
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
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””
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.