How create a random sequence

7 次查看(过去 30 天)
Hi, I want to create a random sequence of 10 elements with values +- 2.How can i do it?
BR,
José Manuel.
  1 个评论
the cyclist
the cyclist 2013-11-24
Do you want only values of -2 and 2, or continuous values uniformly in between, like -1.732 and 0.365?

请先登录,再进行评论。

采纳的回答

the cyclist
the cyclist 2013-11-24
编辑:the cyclist 2013-11-24
Just -2 and 2:
R = 4*round(rand(1,10)) - 2;
Continuous:
R = 4*rand(1,10) - 2;
  1 个评论
pizarro
pizarro 2013-11-24
Thank you very much, I´m starting to study Matlab from myself.
BR,
José Manuel.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by