The steady state response of a synchronous machine to the torque with angle dependent pulsating component is of great practical importance for the piston drive. Determining such a response is not easy due to the necessity of solving the system of nonlinear differential equations. This paper describes an algorithm that allows directly determining the steady states of a synchronous machine driven by an internal combustion engine (e.g. diesel engine). To create such an algorithm, the harmonic balance method and the iterative Newton–Raphson procedure are used. This approach allows obtaining steady-state solutions directly in the frequency domain. Exemplary calculations are performed for synchronous generators derived from the four-stroke internal combustion engine.