Programming Assignments
Introduction :: Exercises
Exercises
 Generate 1000 points of a random variable. Plot the histogram of the data. Estimate the mean and the variance from the data you generate. How closely do the estimates correspond to actual parameters?
 Generate 1000 points of a random variable. Plot the histogram of the data. Estimate the mean and the variance from the data you generate. How closely do the estimate correspond to the actual parameters?

Write a M
ATLAB
function that will generate
points of
Gaussian
data, where
is a vector of
length
. The function should have the ``declaration''
function X = gengauss(mu,Nigma,N)

The file
prog1dat.mat
(on the class website) contains
data points representing measurements
from a fourdimensional physical system. Load the data into M
ATLAB
using the command
load prog1dat
A variable X will be created with the data in it. Suppose that and is measured. Determine the best estimate of the variables and . Explicitly state all the appropriate covariance and mean vectors, and how you obtain your estimates. 
Continuing the previous problem, suppose that the variables
,
, and
are available. Write a function
predictx4
which will estimate the corresponding value of
.
The function should have the ``declaration''
function x4hat = predictx4(x1,x2,x3)
(with possibly some other arguments as well). If , , , what is the estimate of ? 
Continuing the previous problem, let
be obtained
from the first two components of the fourdimensional data.
Estimate
, the covariance matrix of
, and
, the mean vector.
Plot contours of the pdf of . The function plotellipse.m (on the class website) may be helpful. Compare the axes of the ellipses with the eigenvectors of . What is the relationship?