I was wondering if the spectrogram can be used as a MATLAB tool to check whether or not aliasing will occur when the signal is downsampled from let's say, 44.1kHz to 8kHz? And if yes, how do I go about it?

  • 2
    $\begingroup$ Sure - use the spectrogram to check whether you have any energy above 4 kHz - if you do then you need to filter before resampling. $\endgroup$ – Paul R Sep 4 '12 at 8:48
  • $\begingroup$ Thanks for the reply. Please correct me if I'm wrong. My original fs = 44.1kHz and my desired fs = 8kHz. So, my spectrogram code line should be spectrogram ( signal, 256, 224, 1024, original_fs, 'yaxis' ); Am I right? or should I use the desired_fs in my spectrogram codeline instead? Thanks! @PaulR $\endgroup$ – sakuragurl Sep 4 '12 at 11:11
  • $\begingroup$ That's probably OK, but you can experiment with the parameters until you get a spectrogram that you're happy with: mathworks.co.uk/help/toolbox/signal/ref/spectrogram.html. Note that the sample rate is only used for labelling the Y axis. Use original_fs to see where the energy is in the original signal. If you have anything above the 4 kHz line then you need to filter before resampling. $\endgroup$ – Paul R Sep 4 '12 at 11:16
  • $\begingroup$ Oh I see. Thank you so much for your help @PaulR! :) $\endgroup$ – sakuragurl Sep 4 '12 at 11:40
  • 1
    $\begingroup$ Why are you not checking the DFT of the entire signal? Is there a specific reason you want to use a spectrogram and not a straightforward FFT? $\endgroup$ – Phonon Sep 4 '12 at 16:28

If the spectrogram displayed is sensitive enough to show spectral energy from half the old sample rate to half the new sample rate (e.g. anything at or between 4 kHz to 22.05 kHz), that energy will be aliased unless low-pass filtered out before or during downsampling (to 8KHz). If there is nothing there, then there is nothing that will be aliased by properly interpolated (Sinc kernel, et.al) downsampling without any further low-pass filtering (such as a wider windowed Sinc FIR kernel, etc.)

  • $\begingroup$ I see. Thanks for the detailed explanation :) $\endgroup$ – sakuragurl Sep 6 '12 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.