Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Short Time Fourier Tranform

Subject: Short Time Fourier Tranform

From: hristostev@yahoo.com (hristo)

Date: 29 Nov, 2001 12:14:08

Message: 1 of 8

hello,

I am looking for any available matlab code to compute the short time
fourier transform, that allows me to draw the frequency bands in 3D
dimension,ie. time, frequency, spectrum magnitude

thanks

Subject: Short Time Fourier Tranform

From: Stephan M. Sprenger

Date: 29 Nov, 2001 21:17:00

Message: 2 of 8


Homework problem?

--sms

hristo schrieb:
>
> hello,
>
> I am looking for any available matlab code to compute the short time
> fourier transform, that allows me to draw the frequency bands in 3D
> dimension,ie. time, frequency, spectrum magnitude
>
> thanks

Subject: Short Time Fourier Tranform

From: John Cristion

Date: 29 Nov, 2001 16:42:24

Message: 3 of 8

The function is called SPECGRAM; it's in the Signal Processing toolbox.
It's easy to make your own though.


John

______________________________________________________________________________

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.
 
    SPECGRAM(A,F,Fs,WINDOW) where F is a vector of frequencies in Hz
    (with 2 or more elements) computes the spectrogram at those
frequencies
    using either the chirp z-transform for more than 20 evenly spaced
    frequencies or a polyphase decimation filterbank.
 
    See also PWELCH, CSD, COHERE and TFE.

hristo wrote:
>
> hello,
>
> I am looking for any available matlab code to compute the short time
> fourier transform, that allows me to draw the frequency bands in 3D
> dimension,ie. time, frequency, spectrum magnitude
>
> thanks

Subject: Short Time Fourier Tranform

From: John Cristion

Date: 29 Nov, 2001 16:56:25

Message: 4 of 8

Whoops, I thought that I was in the MATLAB news group. My comments
apply to it. Sorry.

John Cristion wrote:
>
> The function is called SPECGRAM; it's in the Signal Processing toolbox.
> It's easy to make your own though.
>
> John
>
> ______________________________________________________________________________
>
> 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.
>
> SPECGRAM(A,F,Fs,WINDOW) where F is a vector of frequencies in Hz
> (with 2 or more elements) computes the spectrogram at those
> frequencies
> using either the chirp z-transform for more than 20 evenly spaced
> frequencies or a polyphase decimation filterbank.
>
> See also PWELCH, CSD, COHERE and TFE.
>
> hristo wrote:
> >
> > hello,
> >
> > I am looking for any available matlab code to compute the short time
> > fourier transform, that allows me to draw the frequency bands in 3D
> > dimension,ie. time, frequency, spectrum magnitude
> >
> > thanks

Subject: Short Time Fourier Tranform

From: hristostev@yahoo.com (hristo)

Date: 30 Nov, 2001 04:33:21

Message: 5 of 8

thanks john for the reply.
but i am looking for a 3D diplay scene of time-frequency-magnitude.
where the frequency axex matches really the frequency of the signal

i could not do it

any help

John Cristion <cristion@erols.com> wrote in message news:<3C06AF09.49677AF7@erols.com>...
> Whoops, I thought that I was in the MATLAB news group. My comments
> apply to it. Sorry.
>
> John Cristion wrote:
> >
> > The function is called SPECGRAM; it's in the Signal Processing toolbox.
> > It's easy to make your own though.
> >
> > John
> >
> > ______________________________________________________________________________
> >
> > 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.
> >
> > SPECGRAM(A,F,Fs,WINDOW) where F is a vector of frequencies in Hz
> > (with 2 or more elements) computes the spectrogram at those
> > frequencies
> > using either the chirp z-transform for more than 20 evenly spaced
> > frequencies or a polyphase decimation filterbank.
> >
> > See also PWELCH, CSD, COHERE and TFE.
> >
> > hristo wrote:
> > >
> > > hello,
> > >
> > > I am looking for any available matlab code to compute the short time
> > > fourier transform, that allows me to draw the frequency bands in 3D
> > > dimension,ie. time, frequency, spectrum magnitude
> > >
> > > thanks

Subject: Short Time Fourier Tranform

From: dirkman@erols.com (Dirk Bell)

Date: 30 Nov, 2001 12:00:55

Message: 6 of 8

hristostev@yahoo.com (hristo) wrote in message news:<b0ab35d4.0111291214.14e7178e@posting.google.com>...
> hello,
>
> I am looking for any available matlab code to compute the short time
> fourier transform, that allows me to draw the frequency bands in 3D
> dimension,ie. time, frequency, spectrum magnitude
>
> thanks

Try waterfall().

Dirk

Subject: Short Time Fourier Tranform

From: maurice givens

Date: 30 Nov, 2001 14:48:05

Message: 7 of 8

What you want is SPECGRAM in the signal processing toolbox.


 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.

Maurice Givens



Dirk Bell wrote:
>
> hristostev@yahoo.com (hristo) wrote in message news:<b0ab35d4.0111291214.14e7178e@posting.google.com>...
> > hello,
> >
> > I am looking for any available matlab code to compute the short time
> > fourier transform, that allows me to draw the frequency bands in 3D
> > dimension,ie. time, frequency, spectrum magnitude
> >
> > thanks
>
> Try waterfall().
>
> Dirk

Subject: Short Time Fourier Tranform

From: dirkman@erols.com (Dirk Bell)

Date: 30 Nov, 2001 20:38:48

Message: 8 of 8

<SNIP>


If you want something that looks 3-D, not 2-D with the 3rd dimension
indicated by color (which is what a spectrogram does), then use
specgram() to generate the data but not to plot it. Use waterfall() to
plot it to get a 3-D view. The resulting type of display is commonly
called a 'waterfall' plot.

Dirk

Dirk A. Bell
DSP Consultant
(Currently Available)


> What you want is SPECGRAM in the signal processing toolbox.
>
>
> 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.
>
> Maurice Givens
>
>
>
> Dirk Bell wrote:
> >
> > hristostev@yahoo.com (hristo) wrote in message news:<b0ab35d4.0111291214.14e7178e@posting.google.com>...
> > > hello,
> > >
> > > I am looking for any available matlab code to compute the short time
> > > fourier transform, that allows me to draw the frequency bands in 3D
> > > dimension,ie. time, frequency, spectrum magnitude
> > >
> > > thanks
> >
> > Try waterfall().
> >
> > Dirk

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us