0

I know it's a very basic question but couldn't solve it. I need to optimize my values and to do that I have to increase the variables in a certain way such as:

    X_1=(0 0 0)
    x_2=(0 0 0.1)
    x_3=(0 0.1 0.1)
    X_4=(0.1 0 0.1)
    x_5=(0.1 0.1 0.1)
    x_6=(0.2 0 0)
    x_7=(0.2 0 0.1)
    ...

if I do it with for loops such as

for i=0:0.1:2
for j=0:0.1:2
for k=0:0.1:2
x=(0+i 0+j 0+k)
end
end
end

I cannot get all combinations that I want with 3 for loop. Could you please help me about it?

Thanks in advance.

eses
  • 55
  • 5
  • This isn't Matlab code... give us example inputs, desired outputs, and actual code you have – Wolfie Mar 30 '17 at 11:48
  • 1
    look [here](http://stackoverflow.com/questions/18591440/how-to-find-all-permutations-with-repetition-in-matlab) and [here](http://stackoverflow.com/questions/4165859/generate-all-possible-combinations-of-the-elements-of-some-vectors-cartesian-pr) . Just take in account that you will have 21^3 lines. There is no reason to hold such amount of variables, like you presented in the question. – Adiel Mar 30 '17 at 11:52
  • Having separate variables for each combination is going to be a nightmare. Is it possible to store these in a 2D matrix instead? – rayryeng Mar 30 '17 at 13:56

0 Answers0