4. The default variable ans in MATLAB
Lab Session 1.3
>> ans * 4 (ENTER)
ans =
20.0000
5. Using variable in MATLAB programming
Lab Session 1.4
>> a = 10;
>> b = 20;
>> c = 30;
>> d = a + b;
>> e = c – b;
d
e
Result:
d=
30.0000
e=
10.0000
6. Using functions in MATLAB programming
Lab Session 1.5
>> a = sqrt(100)
a=
10.0000
Exercise:
Use MATAB built-in functions for finding average of 10 numbers. Also
find minimum and maximum of 10 numbers list.
8. Order of preference
Precedence
Operation
First
Parenthesis, evaluated starting with the innermost
pair.
Second
Exponentiation, evaluated from left to right.
Third
Multiplication and Division with equal precedence,
evaluated from left to right
Fourth
Addition and subtraction with equal precedence,
evaluated from left to right.