Professional Documents
Culture Documents
Lecture 2
Eng. Mohamed Awni
Electrical & Computer Engineering
Dept.
Agenda
Useful Commands used frequently.
Matlab data type?
Arithmetic Operator & Their Precedence
Examples
The Use of (,) and (;) in matlab
Variables
Elementary math built-in functions.
Useful Commands
There are some commands used most by Matlab users are
>>help functionname
>>lookfor keyword
Useful Commands
>>clc
>>clear
>>Who
>>Whos
Size
Class
logical
char
ab
int8,
int16,
int32,
int64,
numeric
uint8, single
unit16,
unit32,
unit64
cell
{ }
double
struct
Addition
Subtraction
Multiplication
Right Division
Left Division
Exponentiation
Precedence Order
1
2
3
4
Operators
*
/
\
^
Examples
>> +
>>
>>
>> /
>> \ = /
>> ^ (means = )
Operators
Examples
Variables
No need for types. i.e.,
int a;
double b;
float c;
Variables assignment
Using the assignment operator =
Variable_name = A numerical value, or a computable expression
outputs
Examples
Calculate : y= 2*sqrt(a^2-c^2), where a=5 and c= 4
Exercises
Homework