random numbers -1 +1 with 2 decimals without any distribution
Mostra commenti meno recenti
Dear all, How can I generate random numbers ranging between -1 to +1 with 2 decimals and without any kind of distribution? Thanks in advance, Diego
Risposta accettata
Più risposte (1)
Image Analyst
il 8 Gen 2012
Perhaps you're simply looking for something like this:
a = -1; % Lower (min) value.
b = +1; % Upper (max) value
numberOfSamples = 50;
% Create r. Range of r is a to b.
r = a + (b-a).*rand(numberOfSamples, 1)
% Chop off beyond 2 decimal places.
samples = floor(r * 100) / 100
1 Commento
Diego
il 9 Gen 2012
Categorie
Scopri di più su Correlation and Convolution in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!