3_MATLAB_Introduction
3_MATLAB_Introduction
3
4
1
2
Command Window
The Command Window is the main window in MATLAB. Use the
Command Window to enter variables and to run functions and M-files
scripts (more about m-files later
Command Window
Notes for working in the Command Window:-
The clc command (type clc and press Enter), once the clc
command is executed clears the Command Window and a clear
window is displayed
Command History
Statements you enter in the Command Window are logged in the
Command History
Note!
MATLAB is case sensitive! The variables x and X are not the same
Addition + 5+3
Subtraction – 5–3
Multiplication * 5*3
Right division / 5/3
Left division \ 5\3=3/5
Exponentiation ^
Order of Precedence
MATLAB executes the calculations according to the order of
precedence displayed below. This order is the same as used in most
calculators
>> format short, pi, single(pi) %displays both double and single
pi with 5 digits as 3.1416
while
Function Description
sign (x)
Rules about Variable names
A variable can be named according to the following rules:-
Name Description
pi
inf
NaN Not a Number
i, j Used for complex numbers