Question: I need help with writing a MATLAB function named HW 2 _ CountRand with proper comments to do the following: 1 ) Accept a positive

I need help with writing a MATLAB function named HW2_CountRand with proper comments to do the following:
1) Accept a positive integer n as input.
2) Generate a row array of n uniformly distributed random numbers between 0 and 1.(They are not integers).
3) Count how many of the n random numbers in the array are between 0 and 0.5, and assign it to variable n1. No loop should be used for obtaining n1.
4) Use a for loop to generate another n uniformly distributed random numbers between 0 and 1. During the iterations, you use a variable n2 to count how many are between 0 and 0.5.
5) Return n1 and n2.
6) Include function call instructions in the comments.
7) All statements in the function should suppress automatic output

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 Programming Questions!