Engr 383 applied stochastic processes - to become familiar


APPLIED STOCHASTIC PROCESSES

LAB - DISCRETE RANDOM VARIABLES

Objective

To become familiar with histograms and various families of discrete random variables.

Lab Description

Histograms are graphical representations of the distribution of data. A normalized histogram, thus, should provide an estimate of the probability distribution of the outcomes of an experiment. Generating the histogram for discrete data can be as easy as running an experiment several times and counting the number of occurrences of each outcome. In this lab you will generate random sequences responding to several families of random variables, and plot their histograms to compare them to the actual PMFs.

A. Consider the discrete Uniform(l,k) random variable. Do the following:

1. Generate the PMF of the uniform(l,k) distribution for, say, l = -12, k = 4 (use the book as reference if these parameters don't mean anything to you).

2. Obtain the expected value and the variance (i.e. theoretical values) for the corresponding PMF.

3. Generate an N-point vector, say x, of random numbers that have a uniform distribution. Choose a reasonable size for N, and explain your choice.

4. Calculate the sample mean and the sample variance of the vector you generated in step 3. Note that these should approximate the values you found in step 2.

5. In the same figure, plot the following three things (in that order):

a. The first 100 values of the random vector you generated.
b. The PMF of the distribution.
i. The title of this subplot should state the type of distribution and the parameters used.
ii. The title should also show the mean and variance you obtained in step 2.
iii. The mean should be indicated with a vertical, red line, of width 3.
c. The histogram you generated form the random vector.
i. The title of this subplot should show the sample mean and sample variance you calculated in step 4.
The scales of the horizontal and vertical axes of the second and third subplots should be identical.

An example of what I am looking for is shown in the next page.

6. Repeat steps 1-5 for other two other values of l and k.

B. Repeat part A for:
a. Geometric(p) random variable
b. Binomial(n, p) random variable
c. Pascal(k, p) random variable
d. Poisson(α) random variable

Note: for each random variable you should test at least three different parameters (of your choice).

1916_Random variable.jpg

To generate a title for the whole figure (not shown in the figure in the previous page, you may use the function suplabel.m. This function is not part of any Matlab release, and is attached in Appendix A.

To create strings that have variables and text, you can use the num2str() function. An example is shown below:

tt = ['Uniform(',num2str(k), ',' num2str(l), ') RV, m=', ... num2str(m), ', v=', num2str(v)];

Note that three dots at the end of a line are used to extend a command into the next line.

You can embed greek letters in Matlab titles and labels by typing a backward slash followed by the greek letter. For example, \Sigma for Σ and \sigma for σ. Use _ and ^ for subscripts and superscripts, respectively. For example \sigma_X^2 generates σX2.

Deliverables:

You should turn in, via email, at least the following 4 items in a single, cohesive PDF document:

1. Explanation of the code you used to generate the random data.

2. All plots requested, with the corresponding very well documented Matlab code you used to obtain them. Of course I only need one sample Matlab code for each of the distributions. For example, if you did ranges [-12, 4], [4,10], and [2,12] for the uniform distribution, I only need to see Matlab code for one of the three.

3. Analysis/discussion of your code/results.

Attachment:- Lab.rar

Solution Preview :

Prepared by a verified Expert
MATLAB Programming: Engr 383 applied stochastic processes - to become familiar
Reference No:- TGS02644920

Now Priced at $55 (50% Discount)

Recommended (98%)

Rated (4.3/5)