how to change the window length???
18 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I am implementing an FFT over 2 sin signals which are placed at frequencies 300Hz and 380 Hz as the frequency components are very close to each other,I cant resolve then and i know if i increase the window length tbut i cannot change the window length is it possible to change window length in a normal FFT or should i consider the STFT???
0 commentaires
Réponse acceptée
Wayne King
le 26 Jan 2012
Yes in the sense that they will typically change the DFT bin in which they are located, but you have to remember that the frequency axis changes too, which you did not do above.
Fs = 1e3;
t = 0:1/Fs:(100*1/Fs)-1/Fs;
x = cos(2*pi*300*t)+cos(2*pi*310*t);
xdft = fft(x,256);
freq = 0:Fs/256:500;
stem(freq,abs(xdft(1:256/2+1)));
xlabel('Hz'); ylabel('Magnitude');
0 commentaires
Plus de réponses (5)
Wayne King
le 26 Jan 2012
Hi Raj, The frequency resolution depends on the length of the signal and the sampling frequency. The DFT bins are spaced as Fs/N, where Fs is the sampling frequency and N is the length of the input signal. Are you able to increase your signal length?
The STFT is surely going to worsen your frequency resolution because you will be segmenting your signal in order to have some time-frequency analysis.
Wayne King
le 26 Jan 2012
You don't tell us what the size of your t vector is. Applying a window is going to worsen frequency resolution because it broadens the main lobe.
You apply the window in the time domain, not in the frequency domain.
Fs = 100;
t = 0:1/100:1-1/100;
x = cos(2*pi*20*t)+randn(size(t));
x = x'.*hamming(length(x));
xdft = fft(x);
Perhaps your problem in resolving the peaks is because you applied a Hamming window to the DFT coefficients.
Wayne King
le 26 Jan 2012
You need to tell me what the sampling frequency is and how many samples you have.
Assume that the sampling is 1 kHz, then if you have even a short signal, let's say 100 samples, you can easily tell them apart.
Fs = 1e3;
t = 0:1/Fs:(100*1/Fs)-1/Fs;
x = cos(2*pi*300*t)+cos(2*pi*350*t);
xdft = fft(x);
freq = 0:Fs/length(x):500;
plot(freq,abs(xdft(1:length(x)/2+1)));
xlabel('Hz'); ylabel('Magnitude');
0 commentaires
raj
le 26 Jan 2012
3 commentaires
Wayne King
le 26 Jan 2012
There are so many possibilities. You have to decide what kind of frequency resolution you want, e.g. 1 Hz, 2 Hz, 10 Hz, and what the highest frequency you want to resolve is.
raj
le 26 Jan 2012
2 commentaires
Wayne King
le 26 Jan 2012
zero padding does not change the frequency resolution, zero padding only interpolates. You cannot use zero padding to increase your frequency resolution.
Voir également
Catégories
En savoir plus sur Spectral Measurements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!