specgram
Generate a spectrogram for the signal x.
Calling Sequence
[S, f, t] = specgram (x,n,fs,win,overlap)
[S, f, t] =specgram(x)
Parameters
S:
is the complex output of the FFT, one row per slice.
f:
is the frequency indices corresponding to the rows of S.
t:
is the time indices corresponding to the columns of S.
x:
the input signal.
n:
length of the overlapping segments(default,n=256).
fs:
sampling rate of input signal (if specified).
win:
window vector,alternate window to apply rather than the default of hanning (n).
overlap:
specifies the number of samples overlap between successive segments of the input signal. The default overlap is length (window)/2.
Description
Generates a spectrogram for the signal x. The signal is chopped into overlapping segments of length n, and each segment is windowed and transformed into the frequency domain using the FFT. The default segment size is 256. If fs is given, it specifies the sampling rate of the input signal. The argument window specifies an alternate window to apply rather than the default of hanning (n). The argument overlap specifies the number of samples overlap between successive segments of the input signal. The default overlap is length (window)/2.
Examples
N=1024;
n=0:N-1;
w=2*%pi/5;
x=sin(w*n)+10*sin(2*w*n);
[s,f,t]=specgram(x);
grayplot(f,t,s)
xlabel("frequency")
ylabel("time")