Heterogeneities of individual attributes and behaviors play an important role in the complex process of epidemic spreading. Compared to differential equation-based system dynamical models of infectious disease transmission, individual-based epidemic models exhibit the advantage of providing a more detailed description of realities to capture heterogeneities across a population. However, the higher granularity and resolution of individual-based epidemic models comes with the cost of increased computational complexities, which result in difficulty in formulating individual-based epidemic models with mathematics. Furthermore, it requires great effort to understand and reproduce existing individual-based epidemic models presented by previous researchers. We proposed a mathematical formulation of heterogeneous individual-based epidemic models using matrices. Matrices and vectors were applied to represent individual attributes and behaviors. We derived analytical results from the matrix-based formulations of individual epidemic models, and then designed algorithms to force the computation of matrix-based individual epidemic models. Finally, we used a SARS epidemic control as a case study to verify the matrix-based formulation of heterogeneous individual-based epidemic models.