Aiming at the fault diagnosis in a class of discrete linear time-varying system, a novel fault detection and estimation algorithm is proposed. This algorithm uses an introduced virtual fault to construct a discrete fault tracking estimator, and then uses the iterative learning algorithm to regulate the virtue fault close to the practical fault based on the difference between outputs of the estimator and the practical system within the chosen optimization time, thereby reaching the end of the fault diagnosis. This algorithm not only can detect the different-type fault of the system, but also can estimate the fault signal accurately. Simulation results show the effectiveness of this algorithm.