How create a random sequence
9 views (last 30 days)
Show older comments
Hi, I want to create a random sequence of 10 elements with values +- 2.How can i do it?
BR,
José Manuel.
1 Comment
the cyclist
on 24 Nov 2013
Do you want only values of -2 and 2, or continuous values uniformly in between, like -1.732 and 0.365?
Accepted Answer
the cyclist
on 24 Nov 2013
Edited: the cyclist
on 24 Nov 2013
Just -2 and 2:
R = 4*round(rand(1,10)) - 2;
Continuous:
R = 4*rand(1,10) - 2;
More Answers (0)
See Also
Categories
Find more on Random Number Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!