I am using fftw for FFTing a signal which has a sampling rate (changes every time I get a new sample) around 10+-0.05Hz. My input signal has 200 samples. I am getting an output of 100 complex nos. Now to get the resolution for my fft and get a frequency corresponding to evry bin I use this:
sampFreq = (float)numFrames*1000000/diffT;
a=sampFreq/numFrames; //freq resolution of each fft bin
b=a/2;
freq = a*index + b; // where index is the index of output bin
numFrames is my initial input size to fft (200) and not the output size. Am I doing it correct or missing a factor of 2?
Also do I need to use Windowing for this case (as in sampling at ~10Hz and 200 frames)
Also please note I am not zero padding my signal as fftw documentation says the sampels can be a multiple of smaller primes, not necessarily only 2, so 200 works I guess.
Yes, you need to use a window function prior to the FFT, otherwise you will suffer with spectral leakage (your spectrum will be smeared).
The resolution of your spectrum is just Fs / N = 10 / 200 = 0.05 Hz, so your 100 point spectrum represents frequencies from 0 Hz (DC) to 5.0 Hz (Nyquist) with each “bin” having a width of 0.05 Hz.
Note that the jitter in your sample rate will have a somewhat unpredictable effect on the resulting spectrum – at the very least it will be somewhat inaccurate, and the resolution will probably suffer.