Spectral synthesis of the nuclear regions of Seyfert 2 and radio galaxies