Generate a group of random number
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
hongtao xu
el 27 de Nov. de 2023
Respondida: Torsten
el 27 de Nov. de 2023
hello
I want to generate 20000 random numbers in the range of (0,1) and it conforms to a normal distribution with a standard deviation of 0.5 and a variance of 1.
please help me
1 comentario
Dyuman Joshi
el 27 de Nov. de 2023
"with a standard deviation of 0.5 and a variance of 1."
Yeah, that's not possible.
Is one of the properties supposed to be mean/average?
Respuesta aceptada
Image Analyst
el 27 de Nov. de 2023
Try this and see if it works for your purposes.
r = 0.5 * randn(20000, 1);
histogram(r);
grid on;
theMean = mean(r)
stDev = std(r)
x = r - 0.5; % Mean center the data
% Do a KS test for normal distribution.
h = kstest(x)
% Do a lillie test for normality.
h = lillietest(x)
0 comentarios
Más respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
