On tau functions for orthogonal polynomials and matrix models