Optimal minimization of total harmonic distortion (OMTHD) and selective harmonic elimination (SHE) switching techniques are usually employed to reduce generated harmonics of multilevel inverters. In the former technique, the THD of waveform is reduced without elimination of any harmonic order and the latter, in contrast, eliminates selected harmonic orders. In this paper, the harmonic elimination ability of the SHE technique is added to OMTHD and an improved OMTHD technique is proposed for an n -level cascaded multilevel inverter with adjustable DC sources. The main novelty of this switching technique is elimination of some harmonic orders, beside THD minimization. Moreover, optimal DC voltages and switching angles can be estimated simpler than conventional OMTHD technique. To show the advantages of the proposed technique, which is formulated for an n -level inverter, a 7-level one is simulated in MATLAB/Simulink with both improved and conventional OMTHD techniques. The obtained results show the elimination of two elective harmonics as well as THD minimization. Moreover, experiments on a 7-level inverter verify the superiority of the proposed technique.