필터 지우기
필터 지우기

How to generate Zero mean and unit variance

조회 수: 30 (최근 30일)
Dick Rusell
Dick Rusell 2014년 9월 18일
댓글: the cyclist 2021년 2월 19일
I'm not sure how to generate 1024 samples of pseudo random numbers with zero mean and unit variance using rand and to verify the results with mean, std, and hist.
  댓글 수: 2
the cyclist
the cyclist 2014년 9월 18일
What distribution do you want? Uniform? Normal? Something else?
Dick Rusell
Dick Rusell 2014년 9월 18일
I think it is supposed to be uniform.

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

채택된 답변

Roger Stafford
Roger Stafford 2014년 9월 18일
편집: Roger Stafford 2014년 9월 18일
If you want a uniform distribution do this:
n = 1024;
x = sqrt(3)*(2*rand(n,1)-1);
The random variable x will have a statistical mean of 0 and variance of 1. Of course any given n-element sample will deviate from these. These are only the statistically expected values.
  댓글 수: 2
senthil vel
senthil vel 2019년 1월 8일
why sqrt(3)*(2*rand(1024,1)-1)
Marius Hernes Brateng
Marius Hernes Brateng 2020년 10월 20일
this comes from the definition of variance. Solve this equation for a, get a = sqrt(3).

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

추가 답변 (2개)

the cyclist
the cyclist 2014년 9월 18일
편집: the cyclist 2014년 9월 18일
randn(1024,1)
will generate 1,024 normally distributed values from a population with zero mean and unit variance.
  댓글 수: 3
soumya dwibedy
soumya dwibedy 2021년 2월 16일
how to generate 1000 normally distributed values with (2 7 )mean and unit variance
the cyclist
the cyclist 2021년 2월 19일
It's usually better to post a new question, than a comment on a 6-year-old one (even though this is related). People won't typically see a comment buried in an old post. It was just lucky that I did.
I don't understand what you mean by "(2 7)mean". Did you you mean just "27"?

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


majid
majid 2014년 9월 19일
편집: majid 2015년 5월 31일
it helped me so much...thank you انجام پروژه متلب

카테고리

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