0% found this document useful (0 votes)
38 views

Problem Set 4: MAS160: Signals, Systems & Information For Media Technology

This document discusses several problems related to signals, systems and information for media technology. It includes problems about psychoacoustic masking, Markov processes, entropy coding, error correction, and data compression.

Uploaded by

Fatmir Kelmendi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Problem Set 4: MAS160: Signals, Systems & Information For Media Technology

This document discusses several problems related to signals, systems and information for media technology. It includes problems about psychoacoustic masking, Markov processes, entropy coding, error correction, and data compression.

Uploaded by

Fatmir Kelmendi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

MAS160: Signals, Systems & Information for Media Technology

Problem Set 4
DUE: October 20, 2003
Instructors: V. Michael Bove, Jr. and Rosalind Picard T.A. Jim McBride

Problem 1: Simple Psychoacoustic Masking


The following MATLAB function performs a simple psychoacoustic test. It creates bandlimited noise, centered at 1000 Hz and also creates a sinusoid. It then plays the noise alone and then the noise plus the sinusoid. Try dierent values of f and A to see whether you can detect the sinusoid. For a particular value of f well call A min (f ) the minimum amplitude at which the frequency f sinusoid could still be heard. Plot several values on the graph of f vs. Amin to determine a simple masking curve.
function mask(f,A) % MASK Performs a simple psychoacoustic masking test by creating % bandlimited noise around 1000 Hz and a single sinusoid at % frequency f with amplitude A. It then plays the noise % alone, and then the noise plus the sinusoid. % % f - frequency of sinusoid (0 to 11025) % A - amplitude of sinusoid (0 to 1) % Set sampling rate to 22050 Hz fs = 22050; % Create a bandpass filter, centered around 1000 Hz. Since the % sampling rate is 22050, the Nyquist frequency is 11025. % 1000/11025 is approximately 0.09, hence the freqeuency % values of 0.08 and 0.1 below. For more info, do help butter. [b,a] = butter(4,[0.08 0.1]); % Create a vector of random white noise (equal in all frequencies) wn = rand(1,22050); % Filter the white noise with our filter wf = filter(b,a,wn); % By filtering, weve reduced the power in the noise, so we normalize: wf = wf/max(abs(wf)); % Create the sinusoid at frequency f, with amplitude A: s = A*cos(2*pi*f/fs*[0:fs-1]); % Play the sounds sound(wf,22050) pause(1) sound(wf+s,22050)

% Pause for one second between sounds

PS 4-1

Problem 2: Marko processes, entropy, and grading ;


A particularly lazy teaching assistant is faced with the task of assigning student grades. In assigning the rst grade, he decides that the student has a 30% chance of getting an A, a 40% chance of getting a B, and a 30% chance of getting a C (he doesnt give grades other than A, B, or C). However, as he continues to grade, he is aected by the grade he has just given. If the grade he just gave was an A, he starts to feel stingy and there is less chance he will give a good grade to the next student. If he gives a C, he starts to feel guilty and will tend to give the next student a better grade. Here is how he is likely to grade given the previous grade: If he just gave an A, the next grade will be: A (30% of the time), B (50%), C (20%). If he just gave a B, the next grade will be: A (30%), B (40%), C(30%). If he just gave a C, the next grade will be: A (40%), B (50%), C(10%). (a) (b) (c) (d) Draw a Marko graph of this unusual grading process. Calculate the joint probability of all successive pairs of grades (i.e. AA, AB, AC, etc.) Calculate the entropy, H , of two successive grades given. Calculate the probability distribution of the fifth grade given.

Problem 3: Entropy Coding


Often it is the case that a set of symbols we want to transmit are not equally likely to occur. If we know the probabilities, then it makes sense to represent the most common symbols with shorter bit strings, rather than using an equal number of binary digits for all symbols. This is the principle behind variable-length coders. An easy-to-understand variable-length coder is the Shannon-Fano code. The way we make a Shannon-Fano code is to arrange all the symbols in decreasing order of probability, then to split them into two groups with approximately equal probability totals (as best we can, given the probabilities we have to work with), assigning 0 as an initial code digit to the entries in the rst group and 1 to those in the second. Then, keeping the symbols in the same order, we recursively apply the same algorithm to the two groups till weve run out of places to divide. The pattern of ones and zeros then becomes the code for each symbol. For example, suppose we have an alphabet of six symbols: Symbol A B C D E F % probability 25 25 25 12.5 6.25 6.25 Binary code 000 001 010 011 100 101 Shannon-Fano code 00 01 10 110 1110 1111

Lets see how much of a savings this method gives us. If we want to send a hundred of these symbols, ordinary binary code will require us to send 100 times 3 bits, or 300 bits. PS 4-2

In the S-F case, 75 percent of the symbols will be transmitted as 2-bit codes, 12.5 as 3-bit codes, and 12.5 as 4-bit codes, so the total is only 237.5 bits, on average. Thus the binary code requires 3 bits per symbol, while the S-F code takes 2.375. The entropy, or information content expression gives us a lower limit on the number of bits per symbol we might achieve.
m

H =
i=1

pi log2 (pi )

= [0.25 log 2 (0.25) + 0.25 log 2 (0.25) + 0.25 log 2 (0.25) + 0.125 log 2 (0.125) +0.0625 log 2 (0.0625) + 0.0625 log 2 (0.0625)] If your calculator doesnt do base-two logs (most dont), youll need the following high-school relation that many people forget: loga (x) = log10 (x)/ log 10 (a), so log2 (x) = log10 (x)/0.30103. And the entropy works out to 2.375 bits/symbol. So weve achieved the theoretical rate this time. The S-F coder doesnt always do this well, and more complex methods like the Human coder will work better in those cases (but are too time-consuming to assign on a problem set!). Now its your turn to do some coding. The below is a letter-frequency table for the English language (also available at http://ssi.www.media.mit.edu/courses/ssi/y03/ps4.freq.txt ). 5 E N H C Y V Q 13.105 7.098 5.259 2.758 1.982 0.919 0.121 T R D M P K Z 10.468 6.832 3.788 2.536 1.982 0.420 0.077 A I L U W X 8.151 6.345 3.389 2.459 1.539 0.166 O S F G B J 7.995 6.101 2.924 1.994 1.440 0.132

(a) Twenty-six letters require ve bits of binary. Whats the entropy in bits/letter of English text coded as individual letters, ignoring (for simplicity) capitalization, spaces, and punctuation? (b) Write a Shannon-Fano code for English letters. How many bits/letter does your code require? (c) Ignoring (as above) case, spaces, and punctuation, how many total bits does it take to send the following English message as binary? As your code? [You dont need to write out the coded message, just add up the bits.] There is too much signals and systems homework (d) Repeat (c) for the following Clackamas-Chinook sentence (forgive our lack of the necessary Native American diacritical marks!). nugwagimx lga dayaxbt, aga danmax wilxba diqelpxix.

PS 4-3

Problem 4:

Error Correction

A binary communication system contains a pair of error-prone wireless channels, as shown below. 1/8 Sender 1 Error Rate Receiver 1/Sender 2 1/16 Error Rate Receiver 2

Assume that in each channel it is equally likely that a 0 will be turned into a 1 or that a 1 into a 0. Assume also that in the rst channel the probability of an error in any particular bit is 1/8, and in the second channel it is 1/16. (a) For the combined pair of channels, compute the following four probabilities: a a a a 0 0 1 1 is is is is received received received received when when when when a a a a 0 1 1 0 is is is is transmitted, transmitted, transmitted, transmitted.

(b) Assume that a very simple encoding scheme is used: a 0 is transmitted as three successive 0s and a 1 as three successive 1s. At the decoder, a majority decision rule is used: if a group of three bits has more 0s than 1s (e.g. 000, 001, 010, 100), its assumed that a 0 was meant, and if more 1s than 0s that a 1 was meant. If the original source message has an equal likelihood of 1s and 0s, what is the probability that a decoded bit will be incorrect?

Problem 5:

Data Compression

You are given a data le that has been compressed to a length of 100,000 bits, and told that it is result of running an ideal entropy coder on a sequence of data. You are also told that the original data are samples of a continuous waveform, quantized to two bits per sample. The probabilities of the uncompressed values are s 00 01 p(s) 1/2 3/8 s 10 11 p(s) 1/16 1/16

(a) What (approximately) was the length of the uncompressed le, in bits? (You may not need to design a coder to answer this question!) (b) The number of (two-bit) samples in the uncompressed le is half the value you computed in part a). You are told that the continuous waveform was sampled at the minimum possible rate such that the waveform could be reconstructed exactly from the samples (at least before they were quantized), and you are told that the le represents 10 seconds of data. What is the highest frequency present in the continuous signal?

PS 4-4

You might also like