# What should be the singal duration in time doamin to correctly measure its frequency using FFT

I am generating signal consisting of 4 frequencies 380,460,500,580 Hz using 20500 as Fs. I generate this signal for different durations of 0.004s,0.008s,0.02s,0.04s.

Fs=20500;
values=0:1/Fs:duration;
sig1=sin(2*pi*FREQ*values); % FREQ can be 380,460,500,580
sig2 , sig3, sig4
sigt=normr(sig1+sig2+sig3+sig4);


When I take FFT I get different results for different time durations.

   NFFT=2^nextpow2(length(sigt));
Y=fft(sigt,NFFT)/length(sigt);
f=Fs/2*linspace(0,1,NFFT/2+1);
figure, plot(f,2*abs(Y(1:NFFT/2+1)),'r')

• for 0.004s, I get one peak at 480.5 Hz
• for 0.008s , I get one peak at 480.5 and two lower side peak at 320.3 and 640.6.
• for 0.02s ,I get four peaks at 360.4,440.4,520.5,600.6
• for 0.04s , I get four Peaks at 380.4, 460.4,500.5,580.6

All frequencies have time period less than any of above durations. Is there any specific criteria that signal must be in some length so that FFT can detect its frequency. Is there any other method exist which can measure frequency for such short durations? Please share any knowledge.

• The signal duration in time domain is the factor governing frequency resolution after FFT. Also the more the samples the better the averaging and higher the SNR due to processing gain. Might be these argument can help. – Zeeshan Apr 19 '17 at 10:21
• maybe you should look at what the individual bins mean. Since the DFT is a bijective mapping, obviously only signals that can be reproduced by IDFT from a single-bin-set-rest-zero vector can lead to single peaks. – Marcus Müller Apr 19 '17 at 12:46
• thanks all for comment. Actually I have to transmit 250 symbols per sec. each symbol is represented by different DTMF separated by 80 Hz(16x16 table for DTMF). by 250 symbol/sec means i have 1/250 sec to transmit each symbol. at receiver side FFT didnt give me 250 frequencies for sample of 1 sec. What can be the solution, any other modulation scheme? I need to transmit 250 symbols per sec. but receiver can not decode it. NOTE: frequencies have to be in range of 300 Hz to 3500 HZ – Haris_tech Apr 20 '17 at 4:05
• To be honest, I am far from an expert and don't know much about DTMF, but I'll give it a shot. I understand that you have 32 tones equally spaced in your 3200 bandwidth and that you have 256 different symbols (16x16). Why not encode your symbols in a binary fashion making usage of every FFT bin for each symbol transmissions. For 8 bit symbols, you can have 8 tones spaced by 400Hz. According to hotpaw2, you will need a duration of approximately 2/400 = 5ms to separate them correctly, way closer to your target of 4ms (1/250 sec) than 2/80 = 25ms. – Pier-Yves Lessard Apr 20 '17 at 11:25
• thanks Yves. actually i have data of 2000 bits/sec. by making 8-bit chunks we get 250 symbols per sec which can be valued from 0 to 255. I have to use bandwidth between 300-3500. thats why I need 256 different symbols(signals) to be transmit in One sec. to fit all 250 symbols(signals)in one sec , each signal should not be larger than 1/250 sec. Moreover Signal in Time domain should be of some length to be detected by FFT. It might be that it is impossible to achieve. yes you are right , but 400Hz spaced tones will not get fit all data in I sec. – Haris_tech Apr 21 '17 at 4:27

For separating sinusoids (resolution of multiple peaks with clear gaps between them in an FFT magnitude result plot), you normally need an FFT length approximately double the reciprocal of the difference in frequency between the pair that is closest together. This is roughly double the length over which 2 sinusoids are orthogonal, and is required in order to see the gap between, and to have 2 clear peaks instead of just one fat one in an FFT result plot. This length increases if a non-rectangular window is used.

• can you please elaborate this: you normally need an FFT length approximately double the reciprocal of the difference in frequency between the nearest pair. – Haris_tech Apr 20 '17 at 3:57
• 2 / fabs(f1 - f2) – hotpaw2 Apr 20 '17 at 7:45