Académique Documents
Professionnel Documents
Culture Documents
Scanned by CamScanner
Scanned by CamScanner
Question 4
Table of Contents
part i ................................................................................................................................. 1
part ii .............................................................................................................................. 10
Step 1 .............................................................................................................................. 10
Step 2 .............................................................................................................................. 11
Step 4 .............................................................................................................................. 12
part i
x = -5:.2:5; y = -5:.2:5;
[X,Y] = meshgrid(x,y);
Mean = [0 0];
C_xy = [1 0; 0 1];
Mean = [0 0];
C_xy = [1 0; 0 5];
1
Question 4
zlabel('Gaussian distribution');
title('The case for (sigma_x)^2=1 , (sigma_y)^2=5 , p_x_y=0');
figure;
contour(x,y,Gaussian_dist);
xlabel('x');
ylabel('y');
title('The case for (sigma_x)^2=1 , (sigma_y)^2=5 , p_x_y=0');
grid on;
Mean = [0 0];
C_xy = [1 0.25; 0.25 1];
Mean = [0 0];
C_xy = [1 0.25*sqrt(5); 0.25*sqrt(5) 1];
Mean = [0 0];
2
Question 4
Mean = [0 0];
C_xy = [1 0.98; 0.98 1];
% When p_xy=0, there is no relation between x and y values. That is, x and
% y are independent from each other. If p_xy value increases, the
% dependency between x and y increases positively. Furthermore, by
% increasing the variance of a variable, the spread in the distribution
% expands as seen in the figures.
3
Question 4
4
Question 4
5
Question 4
6
Question 4
7
Question 4
8
Question 4
9
Question 4
part ii
Step 1
x = randn(2,1000);
z1 = x(1,:);
z2 = x(2,:);
figure;
scatter(z1,z2);
xlabel('x_1');
ylabel('x_2');
title('Scattering of the columns of x for Step1');
grid on;
%As seen in the scatter plot, the mean of the randomly generated vectors
%are zero and the variances are the same and 1 for x_1 and x_2. They are
%also identically distributed.
10
Question 4
Step 2
A = [4 3 ; 1 2];
y = A*x;
z1 = y(1,:);
z2 = y(2,:);
figure;
scatter(z1,z2);
xlabel('y_1');
ylabel('y_2');
title('Scattering of the columns of y for Step2');
grid on;
%The plot now looks like a line. It can be understood from the scatter plot
%that the mean is again zero but the y_1 and y_2 elements are positively
%correlated to each other.
for k=1:1:1000;
for k=1:1:1000;
for k=1:1:1000;
r_xy=h/sqrt(m*n)
r_xy =
0.9011
11
Question 4
Step 4
B = [4 -3 ; -1 2];
meann = linspace(4,4,1000);
z = (B*x) + mean;
z1 = z(1,:);
z2 = z(2,:);
figure;
scatter(z1,z2);
xlabel('z_1');
ylabel('z_2');
title('Scattering of the columns of z for Step4');
grid on;
% The plot now looks like a line. The column elements of z is negatively
% correlated to each other.
12
Question 4
m=0;
n=0;
for k=1:1:1000;
for k=1:1:1000;
for k=1:1:1000;
r_xy=h/sqrt(m*n)
r_xy =
0.2268
13
Question 4
14