Digital Signal Processing Reference
In-Depth Information
3.7 MATLAB Exercises
Exercise M.3.1 (MATLAB file exercise_M_3_1.m ) Generate uniform and normal
random variables X and Y using the MATLAB functions rand and randn . Deter-
mine whether or not X and Y are independent observing the plot Y vs. X .
Solution The random variable X is uniform in the range [0, 1] and the variable Y is
a Gaussian variable with m ¼ 0 and the variance 1. The plot shown in Fig. 3.29
indicates that the variables are independent.
Exercise M.3.2 (MATLAB file exercise_M_3_2.m )
(a) Generate uniform random variable X over range [ 2, 2]. Random variable
Y ¼ X 2 . Determine whether or not X and Y are correlated observing the plot Y
vs. X . Estimate the coefficient of correlation.
(b) Generate uniform random variable X over range [0, 0.5]. Random variable
Y ¼ X 2 . Determine whether or not X and Y are correlated observing the plot Y
vs. X . Estimate the coefficient of correlation.
(c) Generate uniform random variable X over range [5, 10]. Random variable
Y ¼ X 2 . Determine whether or not X and Y are correlated observing the plot Y
vs. X . Estimate the coefficient of correlation.
(d) Generate uniform random variable X over range [ 10, 5]. Random variable
Y ¼ X 2 . Determine whether or not X and Y are correlated observing the plot Y
vs. X . Estimate the coefficient of correlation.
Solution
(a) The plot
in Fig. 3.30a indicates that
the variables are dependent but
uncorrelated.
4
3
2
1
0
-1
-2
-3
-4
0
0.2
0.4
0.6
0.8
1
X
Search WWH ::




Custom Search