필터 지우기
필터 지우기

Generating random numbers from a certain interval

조회 수: 1 (최근 30일)
arwa
arwa 2016년 11월 17일
댓글: arwa 2016년 11월 17일
Hi, I generated random numbers within the range 0.0 to 0.01 by this code x= 0.0 + (0.01-0.0).*rand() ,but some of generated random numbers x have unwanted value like "1.1902e-004". How can I solve and skip this value to obtain normal values?
Thanks in advance,

채택된 답변

Geoff Hayes
Geoff Hayes 2016년 11월 17일
area - 1.1902e-004 is an alternative format to writing 0.00011902 which is a valid number within your interval. Try calling
format long g
before running your code (to generate the random numbers) and you should see how the effect of this format.
  댓글 수: 1
arwa
arwa 2016년 11월 17일
well, i've tried. it's done
Many thanks for you...

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

추가 답변 (0개)

카테고리

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