PWM-Induced Losses in Electrical Machines: An Impedance-Based Estimation Method