We develop a device model for a heterostructure device with an electron channel and with a periodic system of interdigitated gates. Using this model, we find the conditions of the self-excitation of plasma oscillations in portions of the channel. It is shown that the self-excitation of plasma oscillations in these devices and the terahertz emission observed in the experiments (Otsuji et al 2006 Appl. Phys. Lett. 89 263502; Meziani et al 2007 Appl. Phys. Lett. 90 061105; Otsuji et al 2007 Solid-State Electron. 51 1319) might be attributed to the electron-transit-time effect in the barrier regions.