alan2here
alan2here

Reputation: 3317

Spectrogram example in Matlab

Is there Matlab code that shows a series of numbers representing a waveform as a spectrogram?

The time interval each sample represents is the same, idearly this could also be given to use for the axis scale.

http://www.davegrossman.net/gould/media/spectrum-devocalized.jpg

For example:

spec({1 2 3 2 1 2 3 2}, 0.1 seconds)

or

spec(my_data.txt, 10 Hz)

etc...

Upvotes: 1

Views: 9331

Answers (2)

bandybabboon
bandybabboon

Reputation: 2346

if you look on tftb toolbox, the tfrspwv is a very complex and precise spectrogram code and there is an running script example in the tfrspwv.m code online for making a spectrogram in Matlab.

Upvotes: 0

Oliver Charlesworth
Oliver Charlesworth

Reputation: 272467

If you have the Signal Processing Toolbox, then you can use the spectrogram() function. e.g.:

T = 0:0.001:2;
X = chirp(T,100,1,200,'q');
spectrogram(X,128,120,128,1E3); 

(Example taken from that documentation page.)

The numeric params are window length, overlap length, FFT length and sampling frequency, respectively.

Upvotes: 4

Related Questions