An Analytical Algorithm for Selective Harmonics Elimination and Efficient Control in 5-Level Inverters