OriginLab Corporation - Scientific Graphing and Data Analysis Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis

stft

Contents

Menu Information

STFT

Brief Information

Perform Short Time Fourier Transform

Additional Information

This feature is for OriginPro only.

Command Line Usage

1. stft ix:=col(2);

2. stft ix:=col(2) interval:=4;

3. stft ix:=col(2) option:=complex;

4. stft ix:=col(2) winlen:=32 fftlen:=64 overlap:=16;

5. stft ix:=col(2) win:=tri;

6. stft ix:=col(2) win:=gauss alpha:=3;

7. stft ix:=col(2) win:=kaiser beta:=2;

8. stft ix:=col(2) plot:=0;

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input ix

Input

vector<complex>

<active>

Specifies the input signal

Sampling Interval interval

Input

double

1.0

Specifies the sampling frequency. The default is <auto>, which corresponds to an automatically-calculated interval.

FFT Length fftlen

Input

int

256

Specifies the size of FFT section

Window length winlen

Input

int

256

Specifies the window size, which must not be greater than the size of an FFT section

Overlap overlap

Input

int

128

Specifies the number of data points by which the window sections overlap. It should be less than the window size

Window Type win

Input

int

Rectangle

Specifies the window type used by FFT

Option list

  • rect:Rectangle
    Rectangular window
  • welch:Welch
    Welch window
  • tri:Triangular
    Triangular window
  • bartlett :Bartlett
    Bartlett window
  • hanning:Hanning
    Hann window
  • hamming:Hamming
    Hamming window
  • blackman:Blackman
    Blackman window
  • gauss:Gaussian
    Gaussian window
  • kaiser:Kaiser
    Kaiser window
Alpha alpha

Input

double

0

This variable is only available when Window Type is Gaussian. It specifies the Alpha parameter for Gaussian window.

Beta beta

Input

double

0

This variable is only available when Window Type is Kaiser. It specifies the Beta parameter for Kaiser window.

Option option

Input

int

complex

Specifies the computation option. The default is 2, which correspond to the computing of the amplitude in dB.

Option list

  • complex:Complex Result
    The complex result of stft will be computed.
  • amp:Amplitude Result
    The amplitude of the complex result will be given
  • ampdb:Amplitude in dB
    The amplitude in dB will be computed.
Swap Time and Frequency swapxy

Input

int

0

Specifies whether to swap the time axis and the frequency axis in the image plot.

Output Matrix om

Output

MatrixObject

[<new>]<new>!

Specifies the output matrix See the syntax here.

Plot plot

Input

int

1

Specifies whether an image plot of the result will be generated


Examples

1. To perform stft to Column B using the default setting, use the Command Window:

stft ix:=col(b)

2. To perform stft with Hanning window, use the Command Window:

stft -d

to open the dialog. Then select Hanning window for Window Type.

3. To perform stft using a pre-saved analysis theme called MyTheme, use the Command Window:

stft -t "MyTheme"

Algorithm

stft Computation

stft is computed in the following procedure:

1. N points are taken from the input signal, where N is equal to the window size.

2. A window of the chosen type is used to multiply the extracted data, point-by-point.

3. Zeros will be padded on both sides of the window, if the window size is less than the size of the FFT section.

4. FFT is computed on the FFT section.

5. Move the window according to the user-specified overlap size, and repeat steps 1 through 4 until the end of the input signal is reached.

The Window Functions

The sliding windows are defined as follows:

Rectangular Window:

Image:stft_help_English_files_image011.gif for Image:stft_help_English_files_image012.gif

Welch Window:

Image:stft_help_English_files_image013.gif for Image:stft_help_English_files_image012.gif

Triangular Window:

Image:stft_help_English_files_image015.gif for Image:stft_help_English_files_image012.gif

Bartlett Window:

Image:stft_help_English_files_image017.gif for Image:stft_help_English_files_image012.gif

Hanning Window:

Image:stft_help_English_files_image018.gif for Image:stft_help_English_files_image012.gif

Hamming Window:

Image:stft_help_English_files_image019.gif for Image:stft_help_English_files_image012.gif

Blackman Window:

Image:stft_help_English_files_image020.gif for Image:stft_help_English_files_image012.gif

Gaussian Window:

Image:stft_help_English_files_image022.gif for Image:stft_help_English_files_image012.gif

Kaiser Window:

Image:stft_help_English_files_image024.gif for Image:stft_help_English_files_image012.gif

where I(ix) denotes Bessel Function

Computation of the Sampling Interval

For details of the auto computation of the sampling interval, please see the X-Function document for fft1.

More Information

For more information, please refer to our User Guide.

Related X-Functions

fft1