Combinations of variables and step sizing for creation of DOE
이전 댓글 표시
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.
채택된 답변
추가 답변 (2개)
Tom Lane
2012년 1월 25일
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
Noubara Djimadoumbaye
2012년 2월 2일
Thanks Tom Lane. This answers to my question. Good night!
Paul
2012년 1월 25일
댓글 수: 1
Walter Roberson
2012년 1월 25일
I added the final two steps to my Answer above.
카테고리
도움말 센터 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!