Generate 10000 numbers using RAND with probability

조회 수: 16 (최근 30일)
dlafont
dlafont 2022년 3월 30일
답변: Ganesh shankar ram 2022년 11월 15일
  1. Given a sequence of U(0,1) random numbers, obtain and describe an algorithm that generate binary random numbers with the following point masses:
P{X = 0} = 0.3, P{X = 1} = 0.7
  • Use MATLAB (0, ) random number generator “rand” to generate 10,000 random numbers with the above distribution.
  • Compute the average value of the 10,000 numbers generated. Compare it with the theoretical mean.
  • Give the percentages of the numbers generated that are equal to -1,0, and 1, respectively. Compare them with the point masses and make a comment.
  댓글 수: 4
Torsten
Torsten 2022년 3월 31일
x = rand(0,10000)
You want a vector with 0 rows and 10000 columns ?
dlafont
dlafont 2022년 3월 31일
Ooops Fixed, still getting same error tho

댓글을 달려면 로그인하십시오.

답변 (2개)

Geoff Hayes
Geoff Hayes 2022년 3월 31일
@dlafont - from the error, I think that you have a custom script called rand.m that is is conflicting with the MATLAB rand function. I recommend you delete the /MATLAB Drive/rand.m (or better, rename this file) and try again.

Ganesh shankar ram
Ganesh shankar ram 2022년 11월 15일
Generate Random Sequences of length 10000
uniformly distributed over the interval 0 and0.5

카테고리

Help CenterFile Exchange에서 Random Number Generation에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by