Beat excitation of terahertz radiation in a semiconductor slab in a magnetic field