I need to loop over all the possible combinations of the different elements of a vector between lower and upper bounds.
NUMBEROFVARIABLES stores the total number of variables.
tlb < t < tub
and o1b < o < oub
The elements t
and o
can vary in steps of tStep and oStep respectively.
The vector is: x = [t1, t2, t3, ... tn, o1, o2, o3, ... on]
For 1 < t < 10
, 1.5 < o < 5
, tStep = 1
, oStep = 0.5
and NUMBEROFVARIABLES = 10
(divided equally/half-half between 't's and 'o's), the generated combination vectors should be something like:
x1 = [1, 1, 1, 1, 1, 1.5, 1.5, 1.5, 1.5, 1.5]
x2 = [1, 1, 1, 1, 1, 1.5, 1.5, 1.5, 1.5, 2.0]
x3 = [1, 1, 1, 1, 1, 1.5, 1.5, 1.5, 1.5, 2.5]
.
.
.
xi = [1, 1, 1, 1, 2, 5.0, 5.0, 5.0, 5.0, 5.0]
xii = [1, 1, 1, 1, 3, 5.0, 5.0, 5.0, 5.0, 5.0]
xiii = [1, 1, 1, 1, 4, 5.0, 5.0, 5.0, 5.0, 5.0]
.
.
.
xn = [10, 10, 10, 10, 10, 5.0, 5.0, 5.0, 5.0, 5.0]]
How do I loop over each parameter (like in the above example) and store the vectors xi
in MATLAB?