How do I create a column vector of random numbers between -40 and 40, with "n" entries?
조회 수: 30 (최근 30일)
이전 댓글 표시
I know rand returns random values between 0 and 1 and randi returns random integers, but how do I create a column vector with random numbers within a certain range?
댓글 수: 2
Amit A
2023년 5월 18일
how to create a column vector named srcBits containing 20,000 randomly-generated bits.
Image Analyst
2023년 5월 18일
@Amit A, start your own question in a new thread, and there say how many elements you want in the vector and how many bits are in each number/element of the vector.
답변 (2개)
Star Strider
2016년 10월 26일
If you want random floating-point numbers:
n = 1000; % Pick A Number
rv = 80*rand(n,1)-40; % Vector Of Random Floating-Point Numbers
figure(1)
hist(rv,50) % Check Result (Optional)
댓글 수: 0
참고 항목
카테고리
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!