Question: ( 5 pts ) Write a Matlab function f = randnum ( a , b ) which takes as input two integers a and b

(5 pts) Write a Matlab function f = randnum(a,b) which takes as input two integers
a and b, and generates and returns a random integer that is equally likely to take any
value between a and b (inclusive). Save this function in the file randnum.m.
(b)(5 pts) Write a Matlab m-file test_randnum.m that tests the accuracy of your randnum()
function. This program should use randnum() to generate 100,000 random numbers be-
tween 1 and 10. Store each random number in a vector x (it will be of length 100,000 when
the simulation is done). Then display a histogram of the results using the hist(x,1:10)
function

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!