Using a Recursive Algorithm for Fault Detection in Electrical Systems