Professional Documents
Culture Documents
Project 2
Problem 1:
Mean and variances of various distributions:
1) Normal
Mean: 0.0015
Variance: 16.0306
2) Bernoulli:
Mean: 0.5007
Variance: 0.2500
3) Binomial:
Mean: 0.9008
Variance: 0.9025
4) Erlang:
Mean: 2.9917
Variance: 2.9744
5) Exponential:
Mean: 0.9954
Variance: 0.9958
6) Poission:
Mean: 2.0035
Variance: 2.0187
0.1
0.09
0.08
0.07
0.06
0.05
0.04
0.03
0.02
0.01
0
-15
-10
-5
0
x
10
15
binomial distribution
0.4
0.35
0.3
0.25
0.2
0.15
0.1
0.05
10
15
Erlang distribution
0.1
0.09
0.08
0.07
0.06
0.05
0.04
0.03
0.02
0.01
5
x
10
Exponential distribution
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0.5
1.5
2.5
x
3.5
4.5
0.6
0.7
0.8
0.9
Bernoulli distribution
1.5
0.5
-0.5
0.1
0.2
0.3
0.4
0.5
x
poisson distribution
0.35
0.3
0.25
0.2
0.15
0.1
0.05
10
20
30
x
40
50
60
Outputs:
Normal
1200
1000
800
600
400
200
0
-20
-15
-10
-5
0
x
10
15
20
erlang
1600
1400
1200
1000
800
600
400
200
0
-5
10
15
20
binomial
x 10
3.5
3
2.5
2
1.5
1
0.5
0
10
11
12
Exponential
4000
3500
3000
2000
1500
1000
500
0
-4
-2
10
12
14
Bernoulli
x 10
2500
0
-1
-0.5
0.5
1.5
2.5
poisson
x 10
2.5
1.5
0.5
0
-4
-2
Output Values:
Value of Normal mean=
-0.0056
4
x
10
12
>>
Problem 2:
Source code:
fy=(2*pi)-(2*pi)*rand(1,1000);
for t=0:10;
x=cos((2.*pi.*t)+fy);
m=mean(x);
valueofm(t+1)=m;
end
valueofm
hist(fy,10);
xlim([-10 10])
title('Histogram of Random variable');
%correlation plot
st=1/1000;
t=[0:999]*st;
s1=cos(2*pi*t+fy);
t1=t-(3*st);
s2=cos(2*pi*t1+fy);
[c,lags]=xcorr(s1,s2);
figure
plot(lags,c/max(c))
Outputs:
120
100
80
60
40
20
0
-10
-8
-6
-4
-2
10
1.2
0.8
autocorelation
0.6
0.4
0.2
-0.2
-1000
-800
-600
-400
-200
0
x values
200
400
600
800
1000
Output:
valueofm =
-0.0180
-0.0180
-0.0180