Borrar filtros
Borrar filtros

using normrnd function in a loop

1 visualización (últimos 30 días)
mim
mim el 12 de Sept. de 2013
If I use normrnd function in a loop, every times that normrnd runs in a new loop it will give me the same number? ( if I set parameters to a constant value);
for i = 1 :10
x(i) = normrnd(1,0.2);
end

Respuesta aceptada

the cyclist
the cyclist el 12 de Sept. de 2013
No. It will give a different number on every call (until you reach the end of the pseudorandom generator's period, which is enormous).

Más respuestas (1)

Azzi Abdelmalek
Azzi Abdelmalek el 12 de Sept. de 2013
rng(14) % choose your seed
for i = 1 :10
x(i) = normrnd(1,0.2)
end

Categorías

Más información sobre Loops and Conditional Statements 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