MATLAB: Random numbers within a specific range randomrandom number generator Hi, I would like to know how is possible to generate random draws from a normal distribution , where the rv has a specific range. say within a closed interval [-5, 5]. Thanks Best Answer Considering that:p = normpdf([-5, 5], 0, 1)produces:p = 1.4867e-006 1.4867e-006so the randn function will produce normally-distributed random variables on the interval (-5,+5) with a probability of about 0.999997 or so. Related SolutionsMATLAB: How can we generate random numbers between two negative values. a = -5 ;b = -1.670000000000000 ; r = (b-a).*rand(1000,1) + a; MATLAB: How can I generate random data with percent of outliers in matlab If you want normally-distributed data, use the randn function. To create outliers, create a separate matrix with a larger standard deviation. Related QuestionRandom number within a decimal rangeGenerate real random numbersRandom Gaussian variable distributionRandnHow to add a white Noise with rms amplitude of 0.5 v by matlab
Best Answer