python - Matplotlib spectrogram versus STFT -
i'm computing spectrogram matplotlib. specify nfft=512 resulting image has height of 257. tried stft (short time fourier transform) gives me 512 dimensional vectors (as expected). if plot result of stft can see half of 512 values mirrored 257 values (like matplotlib). can explain me why case? thought of ft basis transform, why introduce redundancy?
thank you.
the redundancy because input strictly real signal fft, dft result complex conjugate (hermitian) symmetric. redundancy due fact imaginary components of strictly real input zero. output of dft can include non-zero imaginary components indicate phase. thus, dft result has conjugate symmetric imaginary components in result cancel out between 2 dft result halves (same magnitudes, opposite phases), indicating strictly real input. also, lower 257 bins of basis transform have 512 degrees of (scaler)freedom, input. however, spectrogram throws away phase information, can display 257 unique values (magnitude-only).
if input complex (quadrature, instance) signal dft, there not hermitian redundancy, , have 1024 degrees of freedom 512 length dft.
if want image height of 512 (given real input), try fft size of 1024.
Comments
Post a Comment