Documente Academic
Documente Profesional
Documente Cultură
Introduction to Matlab
Dr. Norhazwani Md Yunos
Lecture Contents:
Lecture Contents:
MATLAB Introduction
Tool Description
Command Window This is the window in which you execute MATLAB
commands.
Command History This presents a history of the functions introduced in the
Command Window and allows you to copy and execute
them.
Workspace This shows the present contents of the workspace and
allows you to make changes to it.
Help This allows you to search and read the documentation for
the complete family of MATLAB products.
Look at the command window and you will see the cursor flickering
after the prompt ‘>>’.
Help in MATLAB
You can find help for MATLAB via the help button in the toolbar,
and you will be directed to the following page as shown in slide no. 10
Lecture Contents:
The previous result is also available in short format, using the ‘format
short’ command1 .
>> format short
>> (2 + 3i)∧ 10
ans =
-3.4153e+05 - 1.4567e+05i
1
1. format short = Delivers results to 4 decimal places, 2. format long = Delivers
results to 16 significant decimal figures
Dr. Wanie MY BITI 1213 L06: Intro to Matlab 20 / 34
Numerical Computation with MATLAB Variables and Operators
Matrix Variables
MATLAB defines arrays by inserting in brackets all its row elements
separated by a semicolon.
Elements in a row can be entered by separating each element by spaces
or by commas, and a semi-colon indicates the end of each row.
The entire list of elements has to be surrounded by square brackets [ ].
For example, a 3 × 3 matrix variable can be entered in the following two
ways:
>> M = [a11 a12 a13 ; a21 a22 a23 ; a31 a32 a33 ]
>> M = [a11 , a12 , a13 ; a21 , a22 , a23 ; a31 , a32 , a33 ]
Matrix Operations
Sum of matrices A and B: Difference of matrices A and B:
3x1 + 2x2 + x3 = 8
2x1 − x2 + 4x3 = 5
4x1 − 2x2 + 2x3 = 10
Vector
Introduction to Logic I