Random Gaussian number generators

2 visualizaciones (últimos 30 días)
Zahid
Zahid el 12 de Sept. de 2023
Respondida: KSSV el 12 de Sept. de 2023
I am introducing disorder in a 3D lattice which has matrix of L^3 into L^3.
for box disorder "function disorder = generate_disorder(L, W)
% Generate a disordered sequence of on-site energies (diagonal elements of the matrix)
disorder = W * (rand(L, L, L) - 0.5);
end"
I am getting the result.
I want to modify it for generating disorder from gaussian distribution.
How to modify this code?

Respuestas (1)

KSSV
KSSV el 12 de Sept. de 2023
REad about randn
function disorder = generate_disorder(L, W)
% Generate a disordered sequence of on-site energies (diagonal elements of the matrix)
disorder = W * (randn(L, L, L) - 0.5);
end

Categorías

Más información sobre Statistics and Machine Learning Toolbox en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by