king_rachel_ca07

[Your Full Name Goes Here]
ECE 3512: Signals – Continuous and Discrete
Department of Electrical and Computer Engineering, Temple University, Philadelphia, PA 1912
I.
PROBLEM STATEMENT
The purpose of this assignment is for us to become more familiarized with visual representations of joint PDF’s as
well as further understand how covariance matrices and covariance translate to energy and symmetry.
II.
APPROACH AND RESULTS
(1)
Figure 1 - 3D plot of joint PDF, random set of data
(2)
Identity Covariance
Figure 2 - Gaussian Distrubution, Covariance Martix 1
Figure 3 - Suppor Region, Covariance Matrix 1
Equal Energy, Non-Identity
Figure 4 - Gaussian Distribution, Covariance Matrix 2
Figure 5 - Support Region, Covariance Matrix 2
Unequal Variances
Figure 6 - Gaussian Distribution, Covariance Matrix 3
Figure 7 - Support Region, Covariance Matrix 3
Nonzero Off-Diagonal Elements
Figure 8 - Gaussian Distribution, Covariance Matrix 4
Figure 9 - Support Region, Covariance Matrix 4
Unconstrained Covariance
Figure 10 - Gaussian Distribution, Covariance Matrix 5
Figure 11 - Support Region, Covariance Matrix 5
III.
MATLAB CODE
(1)
function CA_7_1
%alocate number of RV's
size = 10e4;
%create 2D, normalized random array
B = rand(size, 2);
B = B/size;
%plot in 3D
hist3(B, [15, 15]);
end
(2)
function CA_7_2
%covariance matricies
con1 = [1 0; 0 1];
con2 = [5 0; 0 5];
con3 = [5 0; 0 2];
con4 = [1 0.5; 0.5 1];
con5 = [5 0.5; 0.5 2];
%graph 3D plots of each covariance matrix and contour lines
surf_pdf(con5)
end
%calculates and plots multivariate normal pdf
%plots contour lines from top view
function surf_pdf(Sigma)
%mean
mu = [6 6];
%mesh grid
x1 = 3:.2:9; x2 = 3:.2:9;
[X1,X2] = meshgrid(x1,x2);
%calculate pdf
F = mvnpdf([X1(:) X2(:)],mu,Sigma);
F = reshape(F,length(x2),length(x1));
%3d plot
figure(1)
surf(x1,x2,F);
caxis([min(F(:))-.5*range(F(:)),max(F(:))]);
axis([3 9 3 9 0 0.05])
xlabel('x'); ylabel('y'); zlabel('Probability Density');
%top view contour
figure(2)
mvncdf([0 0],[1 1],mu,Sigma);
contour(x1,x2,F);
xlabel('x'); ylabel('y');
line([0 0 1 1 0],[1 0 0 1 1],'linestyle','--','color','k');
end
IV.
CONCLUSIONS
For part 1, the shape of the plot is almost a perfect cube, which is a similar concept plotting the pdf of one distribution;
the data is uniformly distributed, and therefore the frequency of each bin occurring should be about even. Because we
have so many points, we are using smaller bin sizes to estimate the pdf; luckily, there was a MATLAB function which
allowed us to easily specify the two-dimensional bin sizes. For part 2, all of the plots matched up with the PowerPoint
figures provided. The first covariance matrix, figure 2, is very symmetric. The energy of both columns of the random
matrix is one, making it the identity covariance matrix. From above (figure 3), the support region is a perfect circle,
further proving that the plot is symmetric in multiple dimensions. In the second matrix, the energies of both signals are
the same, but of a higher magnitude; because of scaling on the y-axis (figure 4), the amplitude appears smaller but is
actually much larger. Once again, the support region is a perfect circle. In the third covariance matrix, the energies of
the two columns are unequal, and therefore we do not see the same symmetry. Figure 7 shows the support region being
elliptical. Because the off-diagonal values are still 0, however, the support region remains in line with the x and y axis.
The same cannot be said about the third covariance matrix; although it cannot be seen from the 3-D view in figure 8,
the top-view in figure 9 shows that the support region has been tiled, due to the fact that off-diagonal values are nonzero.
The last covariance matrix is also tilted due to the same nonzero values, and has unequal energies, making it tilted and
elliptical. Plotting these Gaussian distributions was quite helpful in visualizing a concept that is otherwise somewhat
abstract.