Creating the uniform distribution on [0,2pi) for 1000 times
19 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
yang-En Hsiao
el 29 de Ag. de 2018
I want to Create the uniform distribution on [0,2pi) for 1000 times,and here is my code
for n = 0:1:1000
theta(n)=0+(2*pi)*rand(1,1)
end
But matlab show me the warning: Subscript indices must either be real positive integers or logicals.I don't understand why does it show me this warning,can anyone tell me where am i wrong?
0 comentarios
Respuesta aceptada
Stephan
el 29 de Ag. de 2018
Editada: Stephan
el 29 de Ag. de 2018
Hi,
dont start with n=0:
for n = 1:1:1000
theta(n)=0+(2*pi)*rand(1,1);
end
theta = (2*pi)*rand(1,1000);
Best regards
Stephan
2 comentarios
Kinjal Macwan
el 21 de Mayo de 2021
Editada: Kinjal Macwan
el 21 de Mayo de 2021
@StephanI want to create 500 samples of a signal 𝑑(𝑛) = 𝑠𝑖𝑛 (𝜔0𝑛 +𝜃)
with 𝜔0= 0.05𝜋 and 𝜃 is a random variable that is uniformly distributed between –π and π.
How to write the theta from -pi to pi in this problem?
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!