REPORT
SUBJECT
ACTIVITY
STUDENT
: ECE5883 (ADVANCE SIGNAL PROCESSING)
: TUTORIAL & LABORATORY WEEK 2
NAM
E
ID
: ADANG PRIANTO
: 26520338
Tutorial Question
1. X & y is Random Variable
Mean E[X] = mx
E[Y] = my
Covariance = E[(X-mx) (Y-my)
= E[X Y*] mx my
Covariance E [ X Y ] m x m y
CrossCorrelation=
=
Std Dev x , y
x y
2. Bernoulli Random Variable :Trial variable that give exact 2 possible outcome (success
or not success).
3. Probability Distribution Function, is a statistical function that describes all the
possible values and likelihoods that a random variable can take within a given range.
Probability density function (PDF), or density of a continuous random variable, is
a function that describes the relative likelihood for this random variable to take on a
given value.
4. Expectation random variable x = ak
Given P(x = ak)
E[ X ]= a k P ( x=a k )
k
Given fx()
E [ X ] = f x ( ) d
5. Importance of:
Mean Squared value: it measure average power of random variable.
Standard Deviation: it makes a difference whether the distribution is spread out over
a broad range or bunched up closely around the mean.
1
Adang Prianto | 26520338
6. Joint Distribution function of variable x & y
F( x , y)=P( X x , Y y )
Joint density function
p X , Y ( x , y)=P( X =x , Y = y )
7. Two random variable to be statistically independent
p X , Y ( x , y )= p X ( x ) p y ( y )
Two Random variable X Y said to be orthogonal if the vectors are at perpendicular
to each other.
A set of two or more random variables is called uncorrelated if each pair of
them have no linear relationship. Covariance E(XY) - E(X)E(Y), is zero.
8. Gaussian probability density function
f ( x )=
1( x )
1
exp
2
2
9. Mean and variance of Gaussian distribution function
Mean
Variance
= 2
___________________________________________________________________________
Exercise 1
Step 1 to 6
Syntax
Function Syntax
X=1.*randn(1,1000)+0;
%% Generate R.V. with variance=1, mean=0
plot(X);
title('Plot of Random Variable');
xlabel('x');
ylabel('y');
[Mean_Data,Variance_Data]=mean_var(X);
%% Function to calculate mean and
variance
function [m,v]=mean_var(x)
m = sum(x)/length(x)
v = sum((x-m).^2)/(length(x)-1)
end
Adang Prianto | 26520338
Step 7
True Mean
=0
True variance = 1
Mean of generated R.V.
= 0.0383
Variance of generated R.V.
= 1.0110
Compared to true value of mean and variance, generated value have an error or difference
0.0383 and 0.0110 for mean and variance respectively.
Step 8
Increase sample e.g. up to 100000 sample
m
= -0.0012
0.9956
The difference is much smaller, calculated value of mean and variance is closer to the true
value. Larger sample will give more accurate estimation.
___________________________________________________________________________
Exercise 2
1. Random vector Y with mean = 2 and variance = 4
E[Y] = a E[X] + b
2 = a . (0) + b
b =2
Var (Y)= a2 Var (X) + 0
3
Adang Prianto | 26520338
4 = a2 (1)
a =2
2. Matlab calculation of mean and variance
m
= 2.0188
v
= 3.9627
Sample mean of Y is higher compared to sample mean of X, shown in figure above.
Random variable of Y tend to clustered at centre value 2, while Y at 0. The variance
has similar behaviour as mean, data of random variable Y is scattered from -5 to
-9, higher than X which is scattered within interval -3 to -3.
_____________________________________________________________________
Exercise 3
Syntax
function CDFVec=mycdffunc(X,x) %% Function
N=length(X);
for x_index=1:length(x)
CDFVec(x_index)=(1/N)*sum(X<=x(x_index));
end
end
CDFVec=mycdffunc(X,x);
plot(CDFVec)
hold on
title('Cumulative Distribution Function')
X=randn(1,20); %% Sample change for N=20,200,2000
CDFVec=mycdffunc(X,x);
4
Adang Prianto | 26520338
plot(CDFVec)
hold on
legend('N=20','N=200','N=2000')
___________________________________________________________________________
Exercise 4
Syntax
Beta=3;
X=rand(1,1000);
Y=(-1/Beta)*log(X);
[Ng,n]=hist(Y,50);
Bin_width=n(3)-n(2);
Pvec=Ng/Bin_width/50;
Tpdf=3.*exp(-3*n);
plot(Pvec,n);
hold on
plot(Tpdf);
title('Transform Uniform to Exponential')
legend('Calculated Py(y)','True Value Py(y)')
Bin
1
2
3
4
5
5
Total
23
20
20
14
22
Bin
11
12
13
14
15
Total
24
18
17
23
28
Bin
21
22
23
24
25
Total
0
1
1
1
0
Bin
31
32
33
34
35
Total
1
0
0
0
1
Bin
41
42
43
44
45
Total
0
0
0
0
0
Adang Prianto | 26520338
6
7
8
9
10
25
20
15
21
18
16
17
18
19
20
17
23
27
26
26
26
27
28
29
30
1
0
0
1
1
36
37
38
39
40
0
0
0
0
0
46
47
48
49
50
0
0
0
0
1
Bin_width = 0.0199
_____________________________________________________________________
Exercise 5
sigma_R = 3;
N = 10000;
U = rand(1,N);
R = sqrt(-2*sigma_R*log(U))
[Ng,n] = hist(R,20);
size(Ng)
p_hist=Ng/10000/(n(3)-n(2));
size(p_hist)
plot(n,p_hist);
Ray_pdf = (n/sigma_R).*exp(-n.^2/2/sigma_R);
hold on
Adang Prianto | 26520338
plot(n,Ray_pdf,'r')
title('Uniform to Rayleigh Transform')
legend('Calculated PDF','True PDF')
Adang Prianto | 26520338