3
$\begingroup$

Ok, so I recently started playing around with an SDR in an effort to challenge and educate myself. So, let's say the sampling rate (Fs) is 3MHz and of those we grab 3M samples. Now we are left with 3M samples consisting each of an IQ pair. Complex data. My understanding is that I would perform an FFT using the entire sample, consisting of IQ as the input for the FFT which would yield another complex answer. From this, calculate the magnitude and plot starting from 0? I'm not entirely positive which samples to throw out, which ones to keep, and in which order to plot them.

Do I perhaps separate the real and imaginary prior to the FFT for the first 1.5M samples, perform an FFT for 1.5M of I and FFT for 1.5M of Q and plot the real to the right of 0 and the imaginary to the left of 0? Throwing out the rest of samples from 1.5-3M?

Any help is very much appreciated. Thanks all.

$\endgroup$
0
$\begingroup$

You do not need to break it into real and imaginary. If you are interested in the spectrum, you will take the FFT and look at its squared absolute value i.e., magnitude square. Better see it in log domain, i.e., $20\log_{10}(|X(f)|)$, starting from 0 to number of FFT points.

For 1Hz resolution you need to take FFT of all 3M samples and FFT size should be 3M. But to ease the computational load you can consider taking a window of 1024 samples then take its FFT using an FFT size of 1024 (In that case each FFT bin corresponds to 3M/1024 Hz). The number 1024 is just an example, you can consider any other value $N$ that suits you.

For plotting take the magnitude response of each window and plot it. This is spectrum plot without any overlap.

For 50% overlap move the window by $N/2$ samples, take another mag. resp. It is better to average the response over few windows.

Windowing is another interesting parameter to play with. In the above case the window is rect, i.e., $w(k) = \sum_{n=0}^{N-1} \delta(k-n)$, where size of window is N. If input signal is $x(k)$ then to pick N points we simply multiply $w(k)$ by $x(k)$. You can see other windows like Kaiser, Hamming or Hanning, and use which ever suits your needs.

$\endgroup$
  • $\begingroup$ Thank you Learner! Very informative and helpful. I tried voting but I don't have enough rep. A newb on SE. Being that I'm interested in plotting both negative and positive frequencies to find the "real" transmitter, should I plot starting from left to right? -1.5MHz - 0hz - +1.5MHz. Not sure how to plot the mag response. - based on 1024 or other. 54321012345? Or 01234543210 or 012345012345 etc. $\endgroup$ – MacGruber May 11 '14 at 13:49
  • $\begingroup$ Question 3.11. How can I make FFTW put the origin (zero frequency) at the center of its output?For human viewing of a spectrum, it is often convenient to put the origin in frequency space at the center of the output array, rather than in the zero-th element (the default in FFTW). If all of the dimensions of your array are even, you can accomplish this by simply multiplying each element of the input array by (-1)^(i + j + ...), where i, j, etcetera are the indices of the element. (This trick is a general property of the DFT, and is not specific to FFTW.) $\endgroup$ – MacGruber May 11 '14 at 20:31
  • $\begingroup$ In order to put origin at zero you need to do some index manipulation. One simple way can be, say the current index values are: $0, 1, 2, ..., F_s/2, F_s/2+1, ... F_s$. Now you need to switch them such that $F_s/2+1, F_s/2+2, ..., F_s, 0, 1, 2, 3, ... F_s/2$. This should work. Maybe you might need to tweak a bit like perhaps ending at $F_s/2-1$ on the right hand side, and starting the index from $F_s/2$. I hope I answered your question. $\endgroup$ – learner May 12 '14 at 7:00

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.