4.23529

4.2 | 17 ratings Rate this file 91 Downloads (last 30 days) File Size: 3.82 KB File ID: #1553

Spectrogram (Short-time FT log magnitude)

by Sean Fulop

 

26 Mar 2002 (Updated 04 Apr 2002)

Computes the Short-time Fourier transform and displays as grayscale image or 3-D surface

| Watch this File

File Information
Description

This program is a modification and extension to Paul Kienzle's spectrogram program for Octave. It is for Matlab 6r12.1. The short-time fourier transform of a signal is computed by FFTs of overlapping windowed signal segments. You can then exit with the complete STFT, as a matrix, or you can go on to plot first a grayscale pseudocolor spectrogram with interpolated shading, and then a color 3-D surface spectrogram viewed from an optimum angle.
I made this because the specgram function in the Matlab toolbox is a joke, it doesn't even use a Fast Fourier Transform, electing to compute the DFT directly in its algorithm. Second, neither that algorithm nor Paul's original program used the pseudo plot, which allows interpolated shading of the colors, which makes the spectrogram look acceptable. The other way (i.e.\ Matlab SP toolbox, Paul's program) of displaying a 2-D plot with a third dimension as color is through an indexed image, but this doesn't allow interpolated shading, and so the spectrograms are totally useless for speech analysis.

MATLAB release MATLAB 6.1 (R12.1)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (24)
22 May 2003 mohammed benbrahim  
14 Jun 2003 D.S. Peterson

a bit wordy, but looks better than matlab's default specgram, even with jet

10 Jul 2003 Don Orofino

Have you tried "specgramdemo" shipping with the Signal Processing Toolbox? It provides an interactive GUI that might meet your need (including interactive colormap scaling ... it does not turn on "interpolated shading", however)

BTW, specgram does call FFT if frequency bins are equally spaced (which is the most typical usage)

29 Jul 2003 w w  
12 Aug 2005 David Michael

Thanks for posting this. I was using MATLAB on a ssh cluster and was unable to get specgram or spectrogram to work properly. Apparently the built in function uses a MEX file and a FORTRAN file that it was unable to find while running on a remote machine. Your 3D graph is lovely. Thanks again.

28 Sep 2005 Aragon Burlingham  
03 Feb 2006 anitha padela  
29 Mar 2006 Hoang Lan

it's useful for me!Thanks

14 Jan 2007 Loong Zh

Thanks! It's intuitive for me to learn how STFT works at the sense of programming in Matlab. Thank you!

30 Apr 2007 sausage Li

great...but why is the default fs=2?

22 May 2007 xuemin chi

very helpful thanks!

23 May 2007 Lifang Xue

It is very useful for a speech researcher.

13 Aug 2007 ding pei

thanks a lot .its very helpful!

29 Sep 2007 Elena Subtirica

thanks a lot! indeed very useful

06 Dec 2007 monoj sinha  
15 Dec 2007 sara wu

thanks a lot

24 Dec 2007 venata subbu

e36 y tg

15 Mar 2008 bouziane mohamed  
15 Mar 2008 ana sari  
08 Apr 2008 Yuan-Tao Weng  
04 May 2008 muhammad rafiq

its a good code for image processing.

26 Nov 2008 Mitko Orcev

can someone point me to a java code for such an application?

19 Jun 2010 Katarzyna Zarnowiec

very helpful, I used this code in my project, thanks!

15 Dec 2011 zuo

thanks for your code

Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
spectral analysis Sean Fulop 22 Oct 2008 06:43:21
spectrogram Sean Fulop 22 Oct 2008 06:43:21
shorttime fourier transform Sean Fulop 22 Oct 2008 06:43:21
timefrequency analysis Sean Fulop 22 Oct 2008 06:43:21
shorttime fourier transform javad khan 26 Aug 2009 09:07:47
shorttime fourier transform zhou xinjian 24 Sep 2009 03:46:36
spectral analysis Josef Mueller 29 Oct 2009 09:43:52
shorttime fourier transform Jose Ercolino 03 Jun 2010 12:07:28
spectral analysis Jose Ercolino 03 Jun 2010 12:07:31
spectrogram Jose Ercolino 03 Jun 2010 12:07:34
timefrequency analysis Jose Ercolino 03 Jun 2010 12:07:38
stft Jose Ercolino 03 Jun 2010 12:07:44

Contact us at files@mathworks.com