The diagnosis algorithm of time-varying failures is considered for a class of nonlinear systems that are affected by external disturbances. By combining the adaptive control theory and the approach of state observer, an anti-disturbance fault diagnosis algorithm has been proposed. When the external disturbances and the internal failures exist simultaneously, the designed fault diagnosis algorithm is able to give specific estimated values of states and failures, respectively, rather than just give a fault warning. The asymptotical stability of the state observer in diagnosis algorithm is guaranteed by setting the adaptive adjusting law of the time-varying failure vector. In addition, a theoretically rigorous proof based on Lyapunov's stability theory has been given. Three experiments have been implemented to evaluate the effectiveness of fault diagnosis algorithm. The experimental results have demonstrated that the performance is satisfactory in both estimation accuracy and convergence speed.