1. In this task, we will generate random vectors and perform some operations related to concepts
we learned in class.
Use a function to generate multi-variate Gaussian data given the parameters of the Gauss-
ian, such as mvgrnd.m (available: https://www.mathworks.com/matlabcentral/ leexchange/4018-
mvgrnd). The function requires you to provide the mean vector and covariance data and the
number of points you would like to sample from the distribution.
(a) Generate 1000 samples from a Gaussian distribution with the following parameters: mean,nu =
[0; 0; 0], and covariance,sigma = [3.5 0 0; 0 0.5 0; 0 0 2].
(b) Generate 1000 samples from a Gaussian distribution with the following parameters: nu =
[0; 0; 0], and sigma = [1 0.5 0.92; 0.5 1.5 0.73; 0.92 0.73 1].
Plot the resulting scatter plots of the data you generate in parts (a) and (b) using the scatter3()
function. What can you conclude about the shape of the data point-cloud as it relates to the pa-
rameters of the distribution?
2. You will now implement your own function to carry out projection of random vectors onto
principle components using concepts you learned in class. Assume that the data are zero-mean.
Implement the following in your custom function (call it ProjectData.m to avoid conflicts with
(i) Assume that the input to the function is a data matrix, X; of size dxn, comprising of n
data samples, each a point (vector) in the d-dimensional Euclidean space, Rd. The output
of the function will be a data matrix Y of size d2xn, where d2 << d.
(ii)Estimate the Covariance Matrix of the Data (you may use the built-in Matlab function,
cov for this).
(iii)Perform the eigen-decomposition of the covariance matrix (you may use the built-in Matlab
function, eig for this). The eigenvector matrix you will get out of this is of size dxd.
(iv)Ensure your eigenvectors and eigenvalues are sorted in descending order of eigenvalues -
i.e., the rst eigenvector corresponds to the largest eigenvalue, and so on...
(v)Your projection (transformation) matrix T is then obtained by selecting the first d2 columns
of the eigenvector matrix, resulting in a transformation matrix T of size d d2
(vi)The transformation T : Rd->Rd2 can be used to project data in the d-dimensional Eu-
clidean space to a (lower) d2 dimensional subspace by the simple matrix operation Y = T'X.
Apply your transformation function to the synthetic Gaussian data generated in problem (1a) above,
projecting the data from a 3-dimensional space to a 2-dimensional space. Estimate and report the
covariance matrix of the projected data Y . Also visualize the 2-dimensional scatter plot of Y and
compare it to the 3-D scatter plot obtained in (1a). What observations can you make about the
original data X and the projected data Y by comparing the covariance matrices and scatter plots?
Explain in detail.
Repeat the exercise above with the data generated in (1b).
Recently Asked Questions
- The Grand Canyon is 6000 feet deep at the deepest part. A rock is dropped from this height. (The acceleration due to gravity is -32 feet/sec2.) a. Express
- design an Employee class that contains the necessary attributes and methods. Then, we will implement a Payroll class that will create and utilize an
- Please refer to the attachment to answer this question. This question was created from Pharmacology-Exam 112.