0
$\begingroup$

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.

Code :

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'

Regular Periodogram

Periodogram with log10 applied on y-axis

Note : The major frequency components (0.06 & 0.94) are marked in red

So, my issue is :

  1. Why do these unwanted frequency components even exist? Shouldn't they have their corresponding power values as 0?
  2. 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?

$\endgroup$
3
$\begingroup$

First of all, if you use a logarithmic graph, it is customary to use dB. In order to convert a FFT in decibels, we use 20*log10, not log10.

Second of all, the "unwanted" frequencies are 10^-30 times smaller than the wanted frequencies, i.e. they are insignificant. . The unwanted frequencies are most likely due to the limited precision of floating-point arithmetic and not due to the sampling process.

https://en.wikipedia.org/wiki/Floating-point_arithmetic

That should answer your second point too...

$\endgroup$
  • $\begingroup$ Thankyou for the reply! There's one point I'm still confused about i.e. the logarithmic graph. In this wiki article they mention the usage of 10*log10 for Power quantities and 20*log10 for Field quantities and root-power quantities. However you suggest the usage of 20*log10 for the Power obtained via FFT. Shouldn't I be using 10*log10 instead as per the article? $\endgroup$ – Argon Jul 17 at 0:53
  • $\begingroup$ It depends, when using amplitude in general we use 20 * log10. Because the power of a signal varies with the square of the amplitude. However, if you perform the FFT on a signal that already represents power, then yes using 10 *log10 is more logical. $\endgroup$ – Ben Jul 17 at 3:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.