function retval = proj2coef(Template,Oldstates) % usage: G = projcoef(Template,Oldstates) % description: generates a coefficient matrix from tensoring % the matrix equation Template*Oldstates = Newstates and % returns the coefficient matrix with all zero entries of a % zero-one matrix Template eliminated from the varible list. % No error checking so get the inputs right! n = sum(sum(Template)); s = size(Oldstates,1); retval = kron(Oldstates',eye(s)); retval = retval(:,find(vec(Template)>0));