1.15 Review Exercises
If you are familiar with the material, you probably want to skip this section and check the exercises in Section 1.16.
1.1. What is the amplitude of a sinusoid
with 30 dBm of power? And the amplitude of another sinusoid
with 30 dB more power than ?
Is it correct to say that a signal has 30 dB of power? You can find the expression for
the power of a sinusoid in Example 1.20. And you may want to read Appendix A.24
for a discussion about dB.
1.2. One has a discrete-time sinusoid with amplitude
volts and wants to generate discrete-time AWGN with power
such that the SNR equals 30 dB. What is the value of
in watts? What are the Matlab/Octave commands to generate both signals?
1.3. To review the alternatives to represent complex numbers, let
and
be two complex numbers and calculate: ,
,
and .
Note that the following two forms of representing complex numbers in the polar
notation are equivalent:
and .
1.4. Calculate by hand and plot the signal
for ,
where
and .
Note that any complex-valued signal
carries information about two real-valued signals and, describing
with graphs requires one for its real component and another for its imaginary
component. Alternatively, the two graphs can describe the magnitude and phase of
.
1.5. Describe in details the header and summarize the contents (list all the information
you could extract from the header such as number of samples, sampling frequency, etc.)
of the following companion files: tidigits_saa7.wav, timit_testdr8mpam0sx199.raw
and timit_testdr8mpam0sx199.wav. These are files that store speech waveforms
(TIDIGITS and TIMIT are famous corpora distributed by LDC – [ url1ldc]). Choose
one of these files and analyze the corresponding signal via two plots: the waveform and
the histogram of amplitudes, both with the abscissa and ordinate properly labeled.
1.6. Using your favorite programming language, list the code for reading raw (without
header) files storing two kinds of data: a) floats (4 bytes) in little-endian format and b)
shorts (2 bytes) in big-endian format. If you like the C language, you may find useful
the companion code laps_dump.c.
1.7. Assume the random vector
a) Calculate its histogram. b) Estimate its probability mass function (PMF). c)
Calculate the moments: mean ,
variance
and .
You may find useful the discussion in Section 1.6.2 and Appendix A.19.3.
1.8. For calculating the variance using its definition
one has to go twice over the data samples. The first loop obtains the mean
and the second loop calculates .
Show a code that uses only one pass over the data by adopting the expression
discussed in Appendix A.19.3.
1.9. a) Generate a realization (one waveform) of a Gaussian random process with 100
i.i.d. (independent and identically distributed) samples of a Gaussian with mean 4 and
variance 3, that is, .
b) Generate a waveform with independent but not identically distributed samples: the
samples with odd indexes are draw from ,
while the samples with even indexes are draw from a uniform distribution
with support .
You can check Section 1.6.2.
1.10. If the task is the generation of a vector of independent and identically
distributed (i. i. d.) samples of random variables, one can simply generate
each one independently and then organize them in a single vector. But
if the task is to generate a vector with a given correlation among its
elements, then a more sophisticated approach is required. Here, we practice
the generation of two-dimensional Gaussian random vectors drawn from a PDF
with mean
and a given covariance matrix. Use the Matlab/Octave’s function mvnrnd or, if you
do not have Matlab’s Statistics Toolbox installed, use the companion octave_mvnrnd
instead. An example follows:
1N = 100000; %number of 2-d vectors 2mu=[2 3]; %mean 3C=[1 0.5 ; 0.5 10]; %covariance matrix 4r = octave_mvnrnd(mu,C,N); %octave_mvnrnd or mvnrnd 5numbiny = 30; numbinx = 30; %number of bins for histogram 6Cest=cov(r) %check estimated covariance matrix (should be close to C) 7mu_est=mean(r) %estimated mean 8R=C+mu'*mu %theoretical correlation matrix 9Rest=Cest + mu_est'*mu_est %estimated correlation matrix 10[n,xaxis,yaxis]=ak_hist2d(r(:,1),r(:,2),numbinx,numbiny); %histogram 11mesh(xaxis,yaxis,n); pause %plot histogram 12contour(xaxis,yaxis,n); xlabel('x1'); ylabel('x2'); %and its countour
The task is to generate realizations of two-dimensional Gaussian random variables, and compare their estimated probability mass functions (PMFs) for the following covariance matrices: a) , . b) and . c) , and . Can you observe the interrelation between the correlations ( and , which are always equal because a covariance matrix is symmetric) and variances ( and ) with the shape of the respective PMFs?