Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Spectrogram using short-time Fourier transform

`s = spectrogram(x)`

`s = spectrogram(x,window)`

`s = spectrogram(x,window,noverlap)`

`s = spectrogram(x,window,noverlap,nfft)`

```
[s,w,t]
= spectrogram(___)
```

```
[s,f,t]
= spectrogram(___,fs)
```

```
[s,w,t]
= spectrogram(x,window,noverlap,w)
```

```
[s,f,t]
= spectrogram(x,window,noverlap,f,fs)
```

`[___,ps] = spectrogram(___)`

`[___] = spectrogram(___,'reassigned')`

```
[___,ps,fc,tc]
= spectrogram(___)
```

`[___] = spectrogram(___,freqrange)`

`[___] = spectrogram(___,'MinThreshold',thresh)`

`[___] = spectrogram(___,spectrumtype)`

`spectrogram(___)`

`spectrogram(___,freqloc)`

`[___,`

also
returns a matrix, `ps`

] = spectrogram(___)`ps`

, containing an estimate
of the power spectral density (PSD) or the power spectrum of each
segment.

`[___] = spectrogram(___,'reassigned')`

reassigns
each PSD or power spectrum estimate to the location of its center
of energy. If your signal contains well-localized temporal or spectral
components, then this option generates a sharper spectrogram.

`[___] = spectrogram(___,`

returns
the PSD or power spectrum estimate over the frequency range specified
by `freqrange`

)`freqrange`

. Valid options for `freqrange`

are `'onesided'`

, `'twosided'`

,
and `'centered'`

.

`[___] = spectrogram(___,`

returns PSD estimates if `spectrumtype`

)`spectrumtype`

is specified as
`'psd'`

and returns power spectrum estimates if
`spectrumtype`

is specified as
`'power'`

.

If a short-time Fourier transform has zeros, its conversion
to decibels results in negative infinities that cannot be plotted.
To avoid this potential difficulty, `spectrogram`

adds `eps`

to
the short-time Fourier transform when you call it with no output arguments.

[1] Oppenheim, Alan V., Ronald W. Schafer, and John R. Buck. *Discrete-Time
Signal Processing*. 2nd Ed. Upper Saddle River, NJ: Prentice
Hall, 1999.

[2] Rabiner, Lawrence R., and Ronald W. Schafer. *Digital
Processing of Speech Signals*. Englewood Cliffs, NJ: Prentice-Hall,
1978.

[3] Chassande-Motin, Éric, François Auger, and
Patrick Flandrin. “Reassignment.” In *Time-Frequency
Analysis: Concepts and Methods*. Edited by Franz Hlawatsch
and François Auger. London: ISTE/John Wiley and Sons, 2008.

[4] Fulop, Sean A., and Kelly Fitz. “Algorithms for
computing the time-corrected instantaneous frequency (reassigned)
spectrogram, with applications.” *Journal of the
Acoustical Society of America*. Vol. 119,
January 2006, pp. 360–371.