How to get 10000 variable numbers between the range of 0 and 100?
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aniket Dutta
am 27 Aug. 2022
Bearbeitet: Star Strider
am 28 Aug. 2022
i want a variable array of 10000 numbers from 0 to 100.
a = -5; b = 5; varx = a + (b-a).*rand(10000,1); varX = 10.^varx;
so i want this in the above format.
can you help me out?
4 Kommentare
Akzeptierte Antwort
Star Strider
am 27 Aug. 2022
Bearbeitet: Star Strider
am 28 Aug. 2022
If you want the numers to be between
and
, use the logspace function, then use randperm to randomise them —
varx = logspace(-5, 5, 1E+5) % Generate Vector
varx = varx(randperm(numel(varx))) % Randomize It
Check = [min(varx) max(varx)] % Check Result
log10Check = log10(Check) % Verify
EDIT — (28 Aug 2022 at 2:16)
‘actually i want the values between 10^(-5) and 10^2.’
varx = logspace(-5, 2, 1E+5) % Generate Vector
varx = varx(randperm(numel(varx))) % Randomize It
Check = [min(varx) max(varx)] % Check Result
log10Check = log10(Check) % Verify
.
0 Kommentare
Weitere Antworten (1)
Abderrahim. B
am 27 Aug. 2022
Verschoben: Image Analyst
am 27 Aug. 2022
Try this --
varx = 100*rand(10000, 1) ;
min(varx)
max(varx)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!