generate coefficient matrix