Professional Documents
Culture Documents
01 - Lecture 1 - Introduction and MATLAB Environment
01 - Lecture 1 - Introduction and MATLAB Environment
1. Unit introduction
Sydney Institute of Business and Technology (SIBT)
Unit number and name: ENGN130 – Introduction and MATLAB Environment
Summary: ENGN130, Computing for Engineers is an introductory programming
course that uses MATLAB and C++ to illustrate general concepts in programming.
This unit enable students to have fundamental knowledge of programming and
MATLAB and C++. This unit is aimed for engineering students. ENGN130
demonstrates how complex engineering and mathematical problems can be solved
using lines in MATLAB and traditional programming languages like C++.
Credit points: 3
Unit level: Undergraduate Unit
1. Unit introduction
Learning outcomes: on successful completion of this unit, students should be able
to:
Gain an understanding of general concepts of programming and obtain a solid foundation
in the use of different programming languages.
Evaluate the applicability of different languages in computer programming.
Solve simple mathematical and engineering problems using an algorithmic approach.
Apply standard programming practices to document, debug and test their programs.
1. Unit introduction
Mode of delivery:
1. Unit introduction
Assessment plan:
1. Unit introduction
Essential readings
Lecture notes
Hahn, B & Valentine, DT 2016, Essential MATLAB for engineers and scientists, 6th edn,
Elsevier Science, Saint Louis.
Deitel, PJ & Deitel, HM 2013, C++: how to program, 7th edittion, Prentice Hall, Boston.
2. Topics
MATLAB introduction and applications
MATLAB environment
Basic commands
Arithmetic in MATLAB
Operators
Variables
3. Power of computers
Applications can be used effectively by computers.
How to develop these applications?
4. Programing languages
Many programing languages which support people to develop software and
applications.
5. Matlab introduction
Matrix Laboratory
A programming package specifically designed for quick and easy scientific
calculations and I/O.
It has literally hundreds of built-in functions for a wide variety of computations
Many toolboxes designed for specific research disciplines: statistics, optimization,
solution of partial differential equations, data analysis.
6. Matlab applications
For Mathematic:
6. Matlab applications
For structural engineering:
6. Matlab applications
For structural engineering:
6. Matlab applications
For electrical engineering:
6. Matlab applications
For data analysis:
6. Matlab applications
For signal analysis:
8. Basic commands
clc: clears the screen
home: moves the mouse back to the left of the screeen
help: support information
edit: opens the editor window
demo: opens demo programs
quit: closes the Matlab window
exit: closes the Matlab window
guide: opens a new GUIs (Graphic User Interfaces)
deploytool: opens the compiling window
9. Arithmetic in Matlab
General functions:
9. Arithmetic in Matlab
Addition (+):
Subtraction (-):
Multiplication (*):
Devision (/):
Exponentiation (.^):
Example 1: simple calculations
9. Arithmetic in Matlab
round (x): rounds a number
sqrt(x): returns the square-root of a number
abs (x): returns the absolution of a number
floor (x): rounds down a number
ceil (x): rounds up a number
Example 2: simple calculations
9. Arithmetic in Matlab
mod (x,y): returns the redundant of the division (x/y)
fix (x): returns the integer of a decimal number
sign (x): returns (-1) if the number is less than 0, return (0) if the number is
equal to 0 and returns (1) if the number is greater than 0.
Example 3:
9. Arithmetic in Matlab
exp (x): returns ex with e = 2.718
log (x): returns ln(x)
Example 4:
9. Arithmetic in Matlab
gcd (x,y): returns the maximum common divisor of x and y
lcm (x,y): returns the minimum common multiple of x and y
Example 5:
tan (x)
asin (x)
acos (x)
atan(x)
12. Operators
Relational operators:
Logical operators:
12. Operators
Using semicolon: the semicolon prevents the value of b to be displayed
Example 6:
>> b = 3;
>> x = 2;
>> y = 3;
>> z = x + y
13. Variables
Temporary variables are only available in the Command window of MATLAB,
when close the window, all of variable will be deleted.
Note: capital letters are different from normal letters: a is not the same A
13. Variables
civilengineer
normalCapital
longname
Chicken45
red_bananas
This_Variable_Name_Is_Quite_Possibly_Too_Long_To_Be_Considered_Good_
Practice_However_It_Will_Work
13. Variables
Name rules:
Must begin with alphabet.
May only contain letters, numbers and underscores ( _ ).
No spaces or punctuation marks allowed
Only the first 63 characters are significant;
Case sensitive (e.g. the variables a and A are not the same).
15. Examples
Example 7: determine the value of the below function
A e5 40 ln 15 with e 2.718
Example 8: determine the value of the below function
B 2 x 4 5 x 3 y sin 3 xy 2 x 2 y with x 2, y 0.5