1 ## Author: Paul Kienzle <pkienzle@users.sf.net>
2 ## This program is granted to the public domain.
5 ## @deftypefn {Function File} fullfact (@var{N})
6 ## Full factorial design.
8 ## If @var{N} is a scalar, return the full factorial design with @var{N} binary
11 ## If @var{N} is a vector, return the full factorial design with choices 1
12 ## through @var{n_i} for each factor @var{i}.
16 function A = fullfact(n)
18 % combinatorial design with n either/or choices
19 A = fullfact(2*ones(1,n))-1;
21 % combinatorial design with n(i) choices per level
23 for i=length(n)-1:-1:1
24 A = [kron([1:n(i)]',ones(rows(A),1)), repmat(A,n(i),1)];