# FFT, 2 Sines.

Cuthbert Nyack
It may sometimes be necessary to identify 2 sinsoids whose frequencies may be close together. The 2 applets below illustrates the spectrum of a signal consisting of 2 sinusoids.

eg parameters (3.0, 5.0, 0.01, 94.08, 512, 45;75, 256, 10.0, 119.5, 0.04) show the case where the frequencies are far apart. n1, n2 on the applet show the number of periods of w1 and w2 in the interval (T2 - T1). In this case n1, n2 are 45 and 75 and the 2 frequencies in the spectra occur as single lines. If the frequencies are not related by a simple 3:5 ratio then a very long sample period may be required to get the spectrum shown here.
Changing T2 to 94.85 show a more realistic spectrum.
Varying T2 or one of the frequencies show the spectrum dependence on the 2 variables. With this frequency spacing a sampling interval of 6.27 is satisfactory to resolve the frequencies as separate lines. If allowance is to be made for sampling a nonintegral number of samples, then the sampling interval should at least be doubled.

eg parameters (4.07, 4.0, 0.001, 89.37, 512, 57:58, 115, 10.0, 119.5, 0.04)
show the case where the frequencies are separated by 0.07rad/s. The sampling period now contains 58 periods of the higher frequency and 57 periods of the lower frequency. The 2 frequencies are clearly resolved. If T2 is reduced to 44.29, the resolution is now 0.141rad/s and the spectrum shows 2 main lines at 3.9645 and 4.1061rad/s instead of 4.0 and 4.07rad/s.

The case where 2 lines are not only close in frequency but different in amplitude can be a challenge, especially if one of the lines is much lower in amplitude than the other. The applet below allow adjustments to be made to the amplitude of the component at w2 by varying the parameter a.
eg parameters (4.0, 4.10, 0.05, 125.42, 512, 80:82, 160, 10.0, 150.0, 0.04) show a very long sample interval can resolvethe 2 components. However this may be upset by changes in T2.