Question: Need help with my Matlab assignment Write a code that will use the random-number generator rand to determine the following: I. The number of random

Need help with my Matlab assignment

Need help with my Matlab assignment Write a code that will use

Write a code that will use the random-number generator rand to determine the following: I. The number of random numbers it takes to add up to 20 . II. The number of random numbers it takes before a number between 0.8 and 0.85 occurs. III. The number of random numbers it takes before the mean of those numbers is within 0.01 of 0.5 (the mean of this random-number generator). Compute the cumulative product of the elements in a vector. The cumulative product of the j^th element of the vector x, Xj, is defined by: P_j = x_1x_2x_3 .... x_j for j = 1:length of the vector x. Create 2 different versions of this function: I. One that uses two for-loops to explicitly carry out the calculations, element by element. An "inner" loop should accumulate the product and an "outer" loop should move through the elements of the vector p. II. One that uses the built-in function prod to replace the inner loop. In each case, you can check your results with the built-in function, compared

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!