Digital Signal Processing Reference
In-Depth Information
In other words, though zero and negative zero have dierent internal represen-
tations, MATLAB will treat them as equal.
Let's do one more example of a number stored in the IEEE 754 standard. Notice
the t parameter that says to treat the number as a 32-bit oating-point value.
>> disp(sprintf(%tx,16.875))
41870000
We can use the chart in Table 10.5. (As a side note, you may see hexadecimal
values in either uppercase or lowercase. For example, 1a3f is the same as 1A3F.)
Writing out the binary values, we have:
hex:
4
1
8
7
0
0
0
0
binary:
0100
0001
1000
0111
0000
0000
0000
0000
.
Now we rewrite the binary string, according to the oating-point standard.
sign
exponent
signicand
0
10000011
00001110000000000000000
The interpretation is positive for the sign. For the exponent we have 10000011 2 =
131 10 , subtracting the bias we get 131127 = 4. With the hidden bit, the signicand
becomes 1.0000111.
The result is +1:00001112 4 , or simply 10000:111.
If we
convert the left half to decimal, we nd it is 2 4
= 16. The right half converts to
3 = :875, so the original number must be 16.875, just like in the
previous sprintf statement.
1 + 2
2 + 2
2
10.9
Frequency Magnitude Response of Sound
The following program plots the frequency magnitude response of sound. Since it
repeats itself in a loop, the graph appears to change in (almost) real time.
The rst few lines set up the variables to save time later. This includes an array
that we will use to show only the rst half of the frequency information, as well
as another array for the x-axis, to show it in terms of actual frequencies instead of
sample number.
% show_sound.m
%
% Get the FMR of a sound
%
Search WWH ::




Custom Search