Method for operating an n-phase electrical machine, where n ≥ 1, controlled by an inverter, wherein the inverter comprises n half-bridge branches (10-U, 10-V, 10-W) having power components in the form of controllable power switching elements and power diodes respectively connected in parallel therewith, wherein each of the half-bridge branches (10-U; 10-V; 10-W) is arranged on a separate semiconductor module (11-U; 11-V; 11-W), which are arranged jointly on a baseplate, wherein, at least for a rotational speed range of the electrical machine below a predefinable rotational speed threshold value, - the phase currents (I_U, I_V, I_W) flowing through the half-bridge branches (10-U, 10-V, 10-W), the voltages and temperatures (t_Sens_U, t_Sens-V, t_Sens_W) present at the power switching elements on the semiconductor modules (11-U, 11-V, 11-W) are determined, - from the current (I_U; I_V; I_W) respectively flowing at a power switching element and from the voltage respectively present, a power loss is calculated for each of the power switching elements, - from the power losses at the respective power switching elements temperature swings (Δt) at all the power switching elements are determined with the aid of first transfer functions and from the power losses at the respective power switching elements a respective temperature swing (Δt_Sens) is determined with the aid of second transfer functions for temperature sensors (13-U, 13-V, 13-W) serving to determine the temperatures on the semiconductor modules (11-U, 11-V, 11-W), wherein the thermal dependencies between the power switching elements and the temperature sensors are also taken into account on the basis of a transfer function; - a temperature (TempCooler) of the baseplate is determined from the determined temperatures (t_Sens_U, t_Sens_V, t_Sens_W) on the semiconductor modules (11-U, 11-V, 11-W) and the determined temperature swings (Δt_Sens) at the temperature sensors (13-U, 13-V, 13-W), and - a torque or a power of the electrical machine is established in a manner dependent on the determined temperature swings (Δt) at all the power switching elements and the determined temperature (TempCooler) of the baseplate. - the phase currents (I_U, I_V, I_W) flowing through the half-bridge branches (10-U, 10-V, 10-W), the voltages and temperatures (t_Sens_U, t_Sens-V, t_Sens_W) present at the power switching elements on the semiconductor modules (11-U, 11-V, 11-W) are determined, - from the current (I_U; I_V; I_W) respectively flowing at a power switching element and from the voltage respectively present, a power loss is calculated for each of the power switching elements, - from the power losses at the respective power switching elements temperature swings (Δt) at all the power switching elements are determined with the aid of first transfer functions and from the power losses at the respective power switching elements a respective temperature swing (Δt_Sens) is determined with the aid of second transfer functions for temperature sensors (13-U, 13-V, 13-W) serving to determine the temperatures on the semiconductor modules (11-U, 11-V, 11-W), wherein the thermal dependencies between the power switching elements and the temperature sensors are also taken into account on the basis of a transfer function; - a temperature (TempCooler) of the baseplate is determined from the determined temperatures (t_Sens_U, t_Sens_V, t_Sens_W) on the semiconductor modules (11-U, 11-V, 11-W) and the determined temperature swings (Δt_Sens) at the temperature sensors (13-U, 13-V, 13-W), and - a torque or a power of the electrical machine is established in a manner dependent on the determined temperature swings (Δt) at all the power switching elements and the determined temperature (TempCooler) of the baseplate.