Question: generating random numbers Matlab... Using the Matlab rand command, generate an array of N = 10^5 random numbers , x_i, i = 1, 2, ...,
generating random numbers Matlab...

Using the Matlab rand command, generate an array of N = 10^5 random numbers , x_i, i = 1, 2, ..., N in the interval [0, 1]. Then, use the cumulative sum function cumsum to construct an array containing the "partial averages" s_1, s_2, ..., s_N defined as s_n = /1n sigma^n_i = 1 xi (a) Plot s_n as a function of n and show that as n gets large, the average value of the first n random numbers in your array approaches 1/2. To show this, add to your plot the line y = 1/2. Your plot should look like that shown in Figure 1. (b) Add a title and axis labels to your plot. For this problem, you wil need the functions rand, cumsum, plot and the colon (: ) operator
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
