Matrix representation of SEM