0% found this document useful (0 votes)
35 views1 page

Spec Gram

This document provides help on using the Matlab function specgram to calculate the spectrogram of a signal. Specgram splits a signal into overlapping segments, windows each segment, and forms the columns of the output matrix with the discrete Fourier transforms of the windows. Each column contains an estimate of the short-term frequency content of the signal over time. The document outlines the parameters and default settings of specgram and provides examples of how to call the function to calculate and plot the spectrogram.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views1 page

Spec Gram

This document provides help on using the Matlab function specgram to calculate the spectrogram of a signal. Specgram splits a signal into overlapping segments, windows each segment, and forms the columns of the output matrix with the discrete Fourier transforms of the windows. Each column contains an estimate of the short-term frequency content of the signal over time. The document outlines the parameters and default settings of specgram and provides examples of how to call the function to calculate and plot the spectrogram.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Purdue University: ECE438 - Digital Signal Processing with Applications

Matlab Help on specgram

SPECGRAM Calculate spectrogram from signal. B = SPECGRAM(A,NFFT,Fs,WINDOW,NOVERLAP) calculates the spectrogram for the signal in vector A. SPECGRAM splits the signal into overlapping segments, windows each with the WINDOW vector and forms the columns of B with their zero-padded, length NFFT discrete Fourier transforms. Thus each column of B contains an estimate of the short-term, time-localized frequency content of the signal A. Time increases linearly across the columns of B, from left to right. Frequency increases linearly down the rows, starting at 0. If A is a length NX complex signal, B is a complex matrix with NFFT rows and k = fix((NX-NOVERLAP)/(length(WINDOW)-NOVERLAP)) columns. If A is real, B still has k columns but the higher frequency components are truncated (because they are redundant); in that case, SPECGRAM returns B with NFFT/2+1 rows for NFFT even and (NFFT+1)/2 rows for NFFT odd. If you specify a scalar for WINDOW, SPECGRAM uses a Hanning window of that length. WINDOW must have length smaller than or equal to NFFT and greater than NOVERLAP. NOVERLAP is the number of samples the sections of A overlap. Fs is the sampling frequency which does not effect the spectrogram but is used for scaling plots. [B,F,T] = SPECGRAM(A,NFFT,Fs,WINDOW,NOVERLAP) returns a column of frequencies F and one of times T at which the spectrogram is computed. F has length equal to the number of rows of B, T has length k. If you leave Fs unspecified, SPECGRAM assumes a default of 2 Hz. B = SPECGRAM(A) produces the spectrogram of the signal A using default settings; the defaults are NFFT = minimum of 256 and the length of A, a Hanning window of length NFFT, and NOVERLAP = length(WINDOW)/2. You can tell SPECGRAM to use the default for any parameter by leaving it off or using [] for that parameter, e.g. SPECGRAM(A,[],1000) SPECGRAM with no output arguments plots the absolute value of the spectrogram in the current figure, using IMAGESC(T,F,20*log10(ABS(B))), AXIS XY, COLORMAP(JET) so the low frequency content of the first portion of the signal is displayed in the lower left corner of the axes. See also PSD

Questions or comments concerning this laboratory should be directed to Prof. Charles A. Bouman, School of Electrical and Computer Engineering, Purdue University, West Lafayette IN 47907; (765) 4940340; [email protected]

You might also like