File Exchange

image thumbnail

Spectrogram (Short-time FT log magnitude)

version 1.0 (3.82 KB) by

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

3.26923
20 Ratings

30 Downloads

Updated

No License

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.

Comments and Ratings (27)

Your function is perfectly working thank you man, i have a question, i m a begginer in matlab and i want to extract the evolution of one harmonic component, i treied many ways but i can't do it, i will realy appreciate you r help & thank you again =).

Ronny Meza

Thanks a lot

zuo

zuo (view profile)

thanks for your code

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

Mitko Orcev

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

muhammad rafiq

its a good code for image processing.

Yuan-Tao Weng

ana sari

bouziane mohamed

venata subbu

e36 y tg

sara wu

thanks a lot

monoj sinha

Elena Subtirica

thanks a lot! indeed very useful

ding pei

thanks a lot .its very helpful!

Lifang Xue

It is very useful for a speech researcher.

xuemin chi

very helpful thanks!

sausage Li

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

Loong Zh

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

Hoang Lan

it's useful for me!Thanks

anitha padela

Aragon Burlingham

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.

w w

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)

D.S. Peterson

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

mohammed benbrahim

MATLAB Release
MATLAB 6.1 (R12.1)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video