2.13 Exercises
2.1. A segment of an ECG signal
with six samples
must be encoded using a 3-points DCT (i. e., using two frames with three
samples each). Find the DCT coefficients of these two vectors. Then,
reconstruct an approximation of the two vectors assuming that only the
first coefficient can be used while the other two are discarded (assumed to
be zero). Confirm Eq. (2.24) calculating the norms of both error vectors
and .
2.2. A segment of an ECG signal with four samples
must be encoded using a 2-points DCT (i. e., using two frames with two
samples each). The coefficients at the DCT domain must be quantized
with 4 bits per frame, with the first coefficient (DC) being quantized with
3 bits and the other one with 1 bit. Both quantizers have a step of
and their first output level is .
a) What is the decoded signal (after coding and decoding)? b) What is the mean
squared-error? c) What is the SNR in dB? d) What is the bit rate in bps assuming
Hz? e) What is the bit rate and SNR if the second coefficient is discarded (no bits are
allocated for it and its value is assumed to be zero during decoding)?
2.3. Consider that a block of pixels
was extracted from an image. Calculate the bi-dimensional DCT and DFT first
processing each row and organizing the result of this intermediate step as a matrix
,
then apply the transforms to each column of
to generate the final matrix. Follow this procedure to obtain a matrix with the DCT
coefficients and then repeat it to obtain the DFT coefficients.
2.4. Design a
DCT-based image coding system that is capable of handling 24 bits/pixel color images
and 8 bits/pixel black and white (B&W, also called gray) images, all with a size of 512
512 pixels. The system should operate using: a) 3 bits/pixel, b) 1 bit/pixel or c) 0.25
bit/pixel. For the three cases, provide the average peak SNR (PSNR), i. e., the SNR
when assuming the “signal” in the numerator is an image with all pixels at the peak
value of 255 and the denominator is the mean squared-error. The test sequence should
be the colorful and B&W versions of the images Lenna, Peppers, Baboon, Splash
and Tiffany, available from [ url2us2]. Do not download B&W versions of the five
mentioned images, but make the conversion from color to B&W yourself and describe
the conversion method you used. Hence, the test set will have 5 images. You can use as
many images you want to compose your training set (distinct from the test set images).
Provide the source code and a short report of your results that includes the average
PSNR.
2.5. Use the Gram-Schmidt procedure to find an orthonormal basis to represent the
vectors in the set .
Show also that any vector in
can be written as a linear combination of the obtained basis vectors.
2.6. KLT (or PCA) is the optimal linear transform for coding. But one needs to
remember that PCA assumes the signal is zero mean. This exercise uses this fact to
exemplify the importance of following the assumed model (in this case, that the signal
is zero mean). Design a coding system for the data x below.
1N=100; %number of vectors 2K=4; %vector dimension 3line=1:N*K; %straight line 4noisePower=2; %noise power in Watts 5temp=transpose(reshape(line,K,N)); %block signal 6x=temp + sqrt(noisePower) * randn(size(temp)); %add (AWGN) noise 7z=transpose(x); plot(z(:)) %prepare for plot
Because PCA / KLT does not model the mean, in practice, one needs to extract
the mean from the data and later recover it for final reconstruction. And, eventually,
one also normalizes the variances to be equal to one. This normalization is called in
statistics to “z-transform” the data, but this term should not be confused with the Z
transform.
2.7. Generate
samples from a bidimensional Gaussian
with mean
and covariance matrix .
Obtain two transforms:
using Gram-Schmidt orthonormalization and
using PCA. You can remove means if useful. Using each transform, project the data
into the new space and compute the variance of the coefficients in each dimension.
Which transform you expect to lead to smaller variances of the transformed vectors?
2.8. Following a scheme similar to the one presented in Application 2.4 - ECG Coding,
compare the performance of KLT and DCT using a test set of at least 50 ECT records
from the MIT-BIH Arrhythmia Database. Note that for performing any preparation /
training you should use a training set, disjoint of the test set. Otherwise your results
can be biased by the fact that you already knew what should be coded.
2.9. Calculate “manually” the DFT of the sequence .
Then use the fft function in Matlab/Octave and compare the results.
2.10. What are the forward
and inverse
matrices for a 3-points orthonormal DFT?
2.11. Consider that
was obtained by sampling with
kHz an analog and periodic signal
.
The sampling theorem was obeyed. The 8-DFT of
was calculated in Matlab/Octave with fft(s)/N and is shown in Figure 2.49. The
value
was chosen to be an exact multiple of the fundamental period of
such that the problem of spurious components illustrated in Figure 2.42 did not
occur. a) What is the frequency of each component of
?
b) What is the resolution
in Hz of this DFT? c) Find a reasonable expression for
.
2.12. Given that was obtained with a 4-points orthonormal DFT, find its inverse . For the same spectrum, assuming that Hz, to which frequencies correspond the elements of ?
2.13. Consider that a periodic was sampled with Hz, obeying the sampling theorem. A 128-points FFT was calculated using Matlab/Octave and the output was normalized by . The only non-zero coefficients were and 125, corresponding to the elements of , and , respectively. a) What is the frequency in Hz of the component with largest power of ? b) what is the average (DC) value of ? c) what is the spacing in Hz between neighboring elements of ? d) what is the maximum frequency found in ?
2.14. Using the orthogonality condition of the basis functions derive the pair of Fourier series equations. To do that, recall how the inner product between complex signals is defined using the conjugate, and the normalization factor because the basis are not orthonormal.
2.15. What are the Fourier series coefficients for the signal ?
2.16. The bilateral Fourier series of a signal with period s has non-zero coefficients , , , and . What is the expression for ?
2.17. What is the Fourier transform of: a) , b) and c) ?
2.18. What is the Fourier transform of: a) , b) and c) ?
2.19. Prove the expressions: a) for the DTFT of and b) for its Z transform, indicating the ROC.
2.20. Considering the range , the DTFT of a signal is 1 when and 0 otherwise (i. e., an ideal low-pass filter). Find its inverse DTFT indicating all steps in this proof.
2.21. Prove that is the DTFT of and indicate when the impulse sifting property is used. Using the result, carefully draw the graph of the real part of the DTFT of for the range .
2.22. Prove the cited properties of the Fourier tools for the case of the Fourier transform.
2.23. Prove the cited Fourier pairs for the case of the DTFT.
2.24. A right-sided signal has Laplace transform , with ROC . Calculate: a) , b) the corresponding Fourier transform if it exists and c) if exists, for rad/s.
2.25. A signal has Laplace transform , with ROC . Find .
2.26. A signal has Z transform , with ROC . Find .
2.27. Find the Z transform and associated ROC of the signal . Does this signal have a DTFT?
2.28. What is the Z transform of the signal ? What are the values of for and ? If the DTFT of exists, what are its values for and rad?