Analysis of spectral properties of harmonic undulator radiation of an electromagnet undulator