Combinations of variables and step sizing for creation of DOE
Show older comments
I'm using matlab to create .txt files containing variables for another program.
I'm trying to create a Design Of Experiments.
An example is, I have 3 variables,v1=5,v2=15 and v3=100
Now each variable also has a step size, v1s=1, v2s=5, v3s=10
and each variable steps by different amounts, so v1a=3,v2a=4,v3a=5
So now I have 3*4*5=60 possible different combinations.
so combination no: 1= 5,15,100 2= 6,15,100 3= 7,15,100 4= 5,20,100 5= 5,25,100 etc....
I'm trying to think of a way that can create all this on the fly for any amount of variables and step sizes but really coming unstuck here.
If anyone has some help it would be greatly appreciated.
Thanks.
Accepted Answer
More Answers (2)
Tom Lane
on 25 Jan 2012
Do you have the Statistics Toolbox available? It seems like what you want is a full factorial design, but with the variable levels chosen from a set other than {1,2,...,k}. Here's an example creating a two-variable design with every combination of {10,20} for the first variable and {100,200,300} for the second.
>> s1 = [10 20];
>> s2 = [100 200 300];
>> x = fullfact([2 3])
x =
1 1
2 1
1 2
2 2
1 3
2 3
>> x(:,1) = s1(x(:,1));
>> x(:,2) = s2(x(:,2))
x =
10 100
20 100
10 200
20 200
10 300
20 300
This is similar to Walter's ndgrid idea, but for three variables it gives a three-column matrix instead of three separate MATLAB variables.
1 Comment
Noubara Djimadoumbaye
on 2 Feb 2012
Thanks Tom Lane. This answers to my question. Good night!
Paul
on 25 Jan 2012
1 Comment
Walter Roberson
on 25 Jan 2012
I added the final two steps to my Answer above.
Categories
Find more on Logical 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!