Create a vector z with 1000 elements generated by the rand-function. The generated values must have a mean value of 0.5 (mean(0.5)). And a standard deviation of sqrt(1/100*12), (std(x)).
조회 수: 6 (최근 30일)
이전 댓글 표시
So my task is to determine mean of an random vector to be set to 0.5. And the set standard deviation to be sqrt(1/100*12)
댓글 수: 2
Adam
2018년 9월 7일
And what have you done so far. I assume you have searched the Matlab help for functions such as 'rand' and followed the links from there to the other random number generation functions.
Rik
2023년 6월 28일
What makes you think after almost 5 years that this question is unclear? Please provide an explanation in a comment.
I have removed your flag and will copy the question below.
Create a vector z with 1000 elements generated by the rand-function. The generated values must have a mean value of 0.5 (mean(0.5)). And a standard deviation of sqrt(1/100*12), (std(x)).
So my task is to determine mean of an random vector to be set to 0.5. And the set standard deviation to be sqrt(1/100*12)
채택된 답변
Cesar Antonio Lopez Segura
2018년 9월 7일
Hi all
Here the code:
mu = 0.5;
sigma = 0.3464;
z = mu + randn(1,1000)*sigma
STDcalculated = std( z )
MuCalculated = mean( z )
댓글 수: 3
Cesar Antonio Lopez Segura
2018년 9월 7일
Hi Vetle,
Using this values you can minimize your error:
mu = 0.50329141240781;
sigma = 0.347330944035507;
참고 항목
카테고리
Help Center 및 File Exchange에서 Random Number Generation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!