Exercise 1

 Assigned: 08/25/11 Due: 08/30/11

A computer is really great for simulating random experiments very quickly. It isn't so good for getting exact probabilities or determining functions. However, it is possible to use the idea of fast random experiments to approximate probabilities or functions related to probabilities. This exercise will help you to become familiar with MATLAB and to do some simple probability experiments.

Getting Started

1. To start MATLAB on a PC in the COE, simply go to Start->Programs and start MATLAB from the menu.
2. To become familiar with some of the ``gee-whiz'' capabilities of MATLAB, try running `demo` and then clicking on `Graphics'' and then ``Fourier series expansion''. Pay attention to the text that is generated in the window. This text shows the MATLAB commands that were used to generate the examples. You may also wish to explore some of the other examples by clicking on different buttons.
3. Run `intro` to get an idea of the basic capabilities of MATLAB.
4. You can type `doc` at any time to get a hypertext version of the MATLAB Reference Guide or `help <cmd>` to get help on specific commands (assuming this is installed on the machine where you are).
5. If you need help on a MATLAB function and the hyperlink doesn't work, simply type "help <function>" at the MATLAB prompt.
6. Although this class will only touch on digital signal processing, the tips I give for using `MATLAB for DSP` are very useful for this class as well.
Please do the following and answer the questions:
1. We can simulate flipping a coin by generating random numbers from a uniform distribution in [0,1) and considering numbers < 0.5 to be tails and numbers >= 0.5 heads.

Do the following in MATLAB:

```trials = 100;
flip = rand(trials,1);
heads = (flip >= 0.5);