My task
I have a signal in .wav format with sampling frequency as 44100Hz. I want to get its power spectrum. I would like to do the STFT with a Hann window with size as 200ms and the window period as 50Hz. The frequency range that I am forcing is from 0 ~ 22000Hz.
My question
Can I get what I want with the following code?
[y, Fs, nbits, opts] = wavread('a.wav');
[S,F,T,P]=spectrogram(y,hanning(8820),7938,[0:100:22000],Fs);
The matrix P returned from the above code is what I want, am I right?
Further question
- What is the relationship between the window size and its FFT size? I through they are independent in the past but I am not sure. Anyone can provide a simple answer or some reference reading?
- I have a command specgram(x, 512, 8000, hamming(80)); --- I guess the original purpose is that:
signal sampling frequency : 8000
window nfft : 1024
window period : 10ms
Actually, I am not sure the original purpose of this code, anyone can read it?