Professional Documents
Culture Documents
x = int16(325);
x = 325.499; x = x + .001;
>>int16(x) >>int16(x)
ans = ans =
325 326
x = 325.5;
>>int16(fix(x))
ans =
325
11
>>int16(325) * 4.39
ans =
1427
>>int8(str)
ans =
72 101 108 108 111 32 87 111 114 108 100
You can also obtain these values with the intmax and intmin functions:
>>intmax('int8') >>intmin('int8')
ans = ans =
127 -128
>>class(c)
ans =
double
>>char(c)
ans =
UPPERCASE
>>get(0, 'format')
ans =
12
short
Set the value for x and display in 5-digit scaled fixed point:
>>format short e
x
x=
1.3333e+000 1.2345e-006
>>format long
x
x=
1.33333333333333 0.00000123450000
>>format rational
x
x=
4/3 1/810045
Set an integer value for x and display it in hexadecimal (base 16) format:
>>format hex
x = uint32(876543210)
x=
343efcea
13
Basic matlab functions
Plotting functions
(i) plot
(ii) stem
(iii) subplot
(iv) xlabel
(v) ylabel
(vi) title
(vii) bar
14