I am trying to make sense of Digital Signal Processing with the help of R language. So, the issue came up when I tried to create a periodogram for a simple sine wave. The regular periodogram shows 2 frequency components as expected (expected frequency & aliased frequency). However, when I looked at the contents of the Power values for this periodogram, I realised that these apart from these 2 frequency components there are other components too, which have relatively very small values(order of e-30). Since, compared to the major 2 frequencies, all the other frequency components appear to be ~ 0, therefore the simple periodogram plot doesn't show them. However, if I plot the periodogram, after applying log function, then these frequency components(the insignificant ones) become visible.
t = 1:100 #Time instances freq_t = 0:99/100 #Fundamental frequencies : t-1/n ,where n is the no. of time instances y = sin(2*pi*0.06*t) #Sine wave with the time instances 't' fft_y = fft(y) #Performing FFT on the 'y' signal spec_y = (abs(fft_y)^2)/100 #To obtain the modulus values of the complex values present in 'fft_y' log_spec_y = log10(spec_y) #applying log at base 10 to the 'spec_y'
Note : The major frequency components (0.06 & 0.94) are marked in red
So, my issue is :
- Why do these unwanted frequency components even exist? Shouldn't they have their corresponding power values as 0?
- How will these minor frequency components affect any sort of analysis that can be performed in the frequency domain?
Speculation for the first issue: Now, for existence of those minor frequency components, the only reason that I can come up with is that the sine wave I made, is basically a sampled signal, hence discrete in nature. In order to approximate this sampled signal, apart from the major frequency components a lot of other minor frequency components should have been used, and that's the reason they show up like this. For instance, consider the Fourier series for square waves. Here, the fitted Fourier series looks like a summation of multiple sine/cosine signals with different frequencies. And the highest frequency of all those sine/cosine signal determines the frequency of the square wave.
As far as the second issue is concerned, I am pretty much clueless about that. Hence can you help me resolve these 2 issues?