An optimal six vector switching pattern in matrix converters for reducing harmonics and switching loss