Assignment 3.1
What You Need to Do
1. Write a MATLAB function binomialPMF that takes as input the scalar quantities n and p and returns a vector containing the binomial distribution with parameters n and p, i.e.
px(k) = (n choose k) * p^k * (1-p)^(n-k), k = 0, 1, ..., n.
Create a single figure containing the following three binomial distributions:
a) n = 30 and p = 0.5 plotted as a solid red line with legend description n = 30 and p = 0.5;
b) n = 30 and p = 0.7 as a solid green line with legend description n = 30 and p = 0.7; and
c) n = 60 and p = 0.5 as a solid blue line with legend description n = 60 and p = 0.5.
Label the x-axis with k, y-axis with p_X(k), and use the title "Binomial Probability Mass Function".
2. Write a MATLAB function geometricPMF that takes as input a value kmax and a scalar quantity p and returns a vector containing the values of a geometric distribution (truncated at kmax) with parameter p, i.e.,
px(k) = p * (1-p)^(k-1), k = 1, 2, ..., kmax.
Using kmax = 20, create a single figure containing the following three geometric distributions:
a) p = 0.2 plotted as a solid red line with legend description p = 0.2;
b) p = 0.6 as a solid green line with legend description p = 0.6; and
c) p = 0.9 as a solid blue line with legend description p = 0.9.
Label the x-axis with k, y-axis with p_X(k), and use the title "Geometric Probability Mass Function".
3.2 What You Need to Turn In
Copy the two figures you created in Section 3.1 into a Microsoft Word document. Resize the figures so that they fit on one page. Your final submission should consist of a printed copy of the figures stapled to a printed copy of your two MATLAB functions. Do not staple this assignment to the problem set that is due on the same day. The assignment is due at the beginning of class on the due date.