Please help me in generating a random string(row vector) in which each element has a different upper bound.
Afficher commentaires plus anciens
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!
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!