4.15 Extra Exercises
- f
4.1. - Taking Figure 1.10 as a reference, decode the DTMF symbols of Figure 4.47, which
correspond to a phone number with eight digits.
Figure 4.47: Eight DTMF symbols, each one with a 100 ms duration. - f
4.2. - Can a discrete-time random process have infinite power? If yes, under what conditions? Can these conditions be achieved in practice?
- f
4.3. - Modify Listing 4.34 to investigate how the sidelobes are decreased in the DTFT of the Hann window
by combining three DTFTs of a rectangular window. Then, perform the same analysis for the Hamming
window.
Listing 4.34: MatlabOctaveCodeSnippets/snip_frequency_testHannDTFT.m 1function snip_frequency_testHannDTFT 2N=9; %number of window samples 3[dtftHann,w]=freqz(hann(N)); %get values of the DTFT as reference 4dtftHann2=0.5*rectWinDTFT(w,N)- 0.25*rectWinDTFT(w+(2*pi/(N-1)),N)... 5 -0.25*rectWinDTFT(w-(2*pi/(N-1)),N); %DTFT using expression 6plot(w,real(dtftHann-dtftHann2),w,imag(dtftHann-dtftHann2)) %error 7end 8function D=rectWinDTFT(w,N) %get DTFT of rectangular window 9D=sin(0.5*N*w)./sin(0.5*w).*exp(-j*0.5*w*(N-1)); 10end
- f
4.4. - Explore the computation and relationships among convolution, correlation and FFT. Assume a vector x=[0
1 4 8 0] with
elements. a) Explain why in Matlab, conv(x,x), the convolution of x with x itself results into a vector with
elements. b) Compare the
equation of a convolution x[n]h[n]
with the equation of an autocorrelation
Then, prove that x[n]x[n]=R[n] and confirm it in Matlab observing that conv(x,fliplr(x)) and xcorr(x) lead to (approximately) the same result in Matlab. Plot conv(x,x) and xcorr(x). c) The results differ in b) mainly because xcorr uses a FFT to compute the correlation. Try to explain how the following code is used to compute the autocorrelation
% Autocorrelation % Compute correlation via FFT X = fft(x,2^nextpow2(2*M-1)); c = ifft(abs(X).^2);
You may want to use type xcorr and take a look at the source code to see how the vector c above is modified to give the expected result (i.e., there is a postprocessing step after the two lines above).
- f
4.5. - Short-time energy. Use the same procedure as before to record the sentence “We were away” or similar. Calculate the speech energy for each frame of milliseconds (ms), without overlap among frames. Use ms to get four energy trajectories. Estimate the first-derivative of using . Estimate the second-derivative using . Use subplot to show simultaneously the waveform (subplot(411)) , (subplot(412)), (subplot(413)) and (subplot(414)). Do that for each and choose the value of that leads to the best plots in terms of distinguishing when it is silence or speech.
- f
4.6. - Use a function such as specgram to plot both the wide and narrowband spectrograms of the sentence recorded in the previous exercise. In both cases, a) what were the window lengths and equivalent bandwidths you used? b) What were the complete commands?
- f
4.7. - Linear regression. Assume there are points , where and . Find the parameters and of a first order polynomial that best fits the data in terms of the minimum total squared error . However, try to write the two final equations using correlations (for example, the autocorrelation at lag is one possible term). Use your equations to fit a line to the following training data: x=rand(1,100); y=3*x+4+0.5*randn(1,100); plot(x,y,’x’) and plot the line superimposed to the training data.
- f
4.8. - Linear predictive coding. Assume the example in Application 4.4, where the LPC filter has order
and the
signal is .
Assuming the autocorrelation method, prove that the coefficients
of the
prediction filter
can be found by solving the matrix equation
where is the correlation at lag .