The behavior observed is due to a phenomenon called aliasing. Aliasing refers to the distortion that occurs when a continuous time signal has frequencies larger than half of the sampling rate. The process of aliasing describes the phenomenon in which components of the signal at high frequencies are mistaken for components at lower frequencies.
To avoid aliasing, ensure that the sampling rate is high enough to avoid any spectral overlap, or use an anti-aliasing filter. In the code, for example, consider "third_frequency" to be 600. Since the sampling frequency, Fs, is 1000, you will notice a component at 1000 – 600 = 400 Hz. If "third_frequency" is 800, you will see a component at 1000 – 800 = 200 Hz.
Best Answer