Code:

Figure 3: Matlab Code for Problem
\includegraphics{Pic2.PNG}