Please help me in generating a random string(row vector) in which each element has a different upper bound.
Show older comments
For example, I want to generate a row vector A randomly
A = [ 4 2 6 1 5 ];
Whose elements are bounded by an upper bound
UB = [ 5 4 6 3 5 ]
E.g. the first element of A can take any integer value between [0 – 5] and second element can take any integer value [0 – 4] and similarly other elements are bounded.
Now from this row vector 'A', N (length (A)), new vectors are to be generated. In each vector, an element of the vector A changes the value randomly within the upper bound and rest of the elements remains same. For example, for above vector A
A = [ 4 2 6 1 5 ];
New vectors are
A1 = [ 3 2 6 1 5 ];
A2 = [ 4 1 6 1 5 ];
A3 = [ 4 2 3 1 5 ];
A4 = [ 4 2 6 3 5 ];
A5 = [ 4 2 6 1 2 ];
Please help. Thanks in anticipation!
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices 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!