new routine for a single matrix fit