2.11.1.1 fft1


Menu Information

Analysis: Signal Processing: FFT: FFT

Brief Information

Compute fourier transform

Additional Information

This feature is updated in 8.0 SR5.

Command Line Usage

1. fft1 ix:=Col(1); 
2. fft1 ix:=(col(2),col(3)); 
3. fft1 ix:=Col(1) interval:=2; 
4. fft1 ix:=Col(1) win:=hanning correct:=power; 
5. fft1 ix:=Col(1) shift:=1; 
6. fft1 ix:=Col(1) psd:=1 norm:=ssa st:=oneside; 

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

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

Input

vector<complex>

<active>

Specifies the input signal, which could be complex. The real and imaginary parts of the signal can be saved in different columns or in the same column. The default is <Active>, which corresponds to the active dataset.

Sampling Interval interval

Input

double

1

Specifies the sampling interval. The default is <Auto>, which corresponds to an automatically-computed interval. Please see the algorithm part for details.

Window win

Input

int

rect

Specifies the type of window to be used for suppressing the leakage. Please see the algorithm part for details.

Option list

  • 0=rect:Rectangle
    Rectangular window
  • 1=welch:Welch
    Welch window
  • 2=tri:Triangular
    Triangular window
  • 3=bartlett:Bartlett
    Bartlett window
  • 4=hanning:Hanning
    Hanning window
  • 5=hamming:Hamming
    Hamming window
  • 6=blackman:Blackman
    Blackman window
  • 7=gauss:Gaussian
    Gaussian window
  • 8=kaiser:Kaiser
    Kaiser window
Alpha alpha

Input

double

0

This variable is only available when window type is Gaussian. It specifies the Alpha parameter (the reciprocal of the standard deviation) 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.

Window Correction correct

Input

int

amplitude

Specifies the Window Correction Factor used to correct the alteration made by applying a window to the input data.

Option list

  • none:None
    No correction is applied.
  • amp:Amplitude
    Amplitude Correction is applied.
  • power:Power
    Energy Correction is applied.
Reserved Reserved

Input

int

0

This is a reserved variable. It has no effect on the computation.

Normalize Re, Im and Mag norma

Input

int

0

Specifies whether to normalize the complex, real, imaginary, magnitude and sqaure magnitude output. The default is false. Note that other outputs such as amplitude are not affected by this variable. Please see the algorithm section for details.

Shift shift

Input

int

1

Specifies whether the result should be rearranged so that the lower frequency components are in the center.

Unwrap phase unwrap

Input

int

1

Specifies whether the phase should be unwrapped. If wrapped, Phase angle is modulo reduced to be between + and - 180 degrees.

Factor factor

Input

int

ee

Specifies whether the Electrical Engineering or Science convention is used to set the sign of the Exponential Phase factor.

Option list

  • ee:-1 (Electrical Engineering)
    The phase factor sign will be opposite to that of the Science option.
  • science:+1 (Science)
    The phase factor will be set according to the formulae listed in page 503 of Numerical Recipes in C, 2nd edition
Spectrum Type st

Input

int

auto

Specifies the Nyquist interval over which power is calculated. Note that this will also affect the computation of other results.

Option list

  • auto:<auto>
    If the input signal is real, one-sided power will be chosen; otherwise, two-sided power will be selected. When this option is selected, Origin will look at the input data to determine whether it is complex or not. If the input data is stored in a column of the Complex data type, but the data contains only a real part, Origin will regard it as real, and not as complex, resulting in a one-sided spectrum. Alternately, if the input data has an all-zero column as the imaginary part, Origin will also regard the input as real, and produce a one-sided spectrum.
  • oneside:One -sided
    One-sided power will be computed.
  • twoside:Two -sided
    Two-sided power will be computed.
Normalize power to norm

Input

int

msa

Specifies the power density normalization method. Please see the algorithm part for detail.

Option list

  • msa:MSA-Mean Square Amplitude
    Mean square amplitude method
  • ssa:SSA-Sum Square Amplitude
    Sum square amplitude method
  • tisa:TISA-Time Interval Square Amplitude
    Time Integral square amplitude method
Preview pre

Input

int

ap

Specifies the preview content in the dialog.

Option list

  • none:None
    NONE
  • ap:Amplitude /Phase
    Both the amplitude and the phase.
  • pp:Power /Phase
    Both the power and the phase.
  • amp:Amplitude
    The amplitude
  • img:Imaginary
    The imaginary parts of the transformed data
  • mag:Magnitude
    The magnitude
  • phase:Phase
    The phase
  • power:Power
    The power spectrum or power density
  • real:Real
    The real parts of the transformed data
  • ri:Real /Imaginary
    Both the real parts and imaginary parts of the transformed data
  • db:dB
    The amplitude in dB.
  • ndb:Normalized dB
    The normalized amplitude in dB.
  • rms:RMS Amplitude
    The RMS amplitude.
  • sqamp:Square Amplitude
    The square amplitude.
  • sqmag:Square Magnitude
    The square magnitude.
Real re

Input

int

1

Specifies whether or not to output a graph of the real parts of the FFT result.

Imag im

Input

int

1

Specifies whether or not to output a graph of the imaginary parts of the FFT result.

Amplitude/Phase ap

Input

int

1

Specifies whether or not to output a combined graph of amplitude and phase.

Phase phase

Input

int

0

Specifies whether or not a graph of the phase will be outputted.

Power/Phase pp

Input

int

0

Specifies whether or not to output a graph of the phase.

Real/Imag ri

Input

int

1

Specifies whether or not to output a combined graph of power and phase.

Magnitude mag

Input

int

1

Specifies whether or not to output a graph of the magnitude.

Amplitude amp

Input

int

0

Specifies whether or not to output a graph of the amplitude.

Power psd

Input

int

1

Specifies whether or not to output a graph of the power.

dB db

Input

int

1

Specifies whether or not to output a graph of the result of dB.

Normalized dB ndb

Input

int

0

Specifies whether or not to output a graph of the result of normalized dB.

RMS Amplitude rms

Input

int

0

Specifies whether or not to output a graph of the RMS amplitude.

Square Amplitude sqr_amp

Input

int

0

Specifies whether or not to output a graph of the squared amplitude.

Square Magnitude sqr_mag

Input

int

0

Specifies whether or not to output a graph of the squared magnitude.

Result Data Sheet rd

Output

ReportData

[<input>]<new>

Specifies the output data sheet.

Result Graph Sheet rt

Output

ReportTree

[<input>]<new template:=graph>

Specifies the output graph sheet.

Examples

  • To perform 1D FFT using default settings on data in columns 2 of the active worksheet, use the script command:

fft1 col(2)

  • Code Sample
// This example plots two different FFT Amplitudes from two date ranges of sunspot data to illustrate the ~11 year sunspot cycle
// Import the data
string fname$ = system.path.program$ + "Samples\Signal Processing\dayssn.dat";
//col(1) = year, col(2)=month, col(3)=day, 
//col(4) = date values in contiguous year with fractions
//col(5) = observation
//so we should have a sheet with 5 col and col(4)=X col(5)=Y
newbook s:=0;newsheet cols:=5 xy:="NNNXY"; 
impasc;
// Interpolate to replace missing values and put result to col(6)
interp1q 4 (4,5) 6;
// this is our data
range rData1 = 6[1:14609];// row range for years 1818 to 1858
range rData2 = 6[54057:end];// row range for years 1966 - 2006

// now start the FFT with the fft1 X-Function which will create a ReportData sheet and a ReportTable sheet
fft1 rData1;
//after running an XF, a tree with same name is created, here we will make use of fft1.rd the ReportData node
range rReportData1=fft1.rd$;//range to hold the Report Data from the FFT result
range rAmp1=%(rReportData1.getlayer()$)col(Amplitude);
rAmp1[C]$="1818 - 1858"; // change the Comment to make better legend for the graph
fft1 rData2;
range rReportData2=fft1.rd$;
range rAmp2=%(rReportData2.getlayer()$)col(Amplitude);
rAmp2[C]$="1966 - 2006";
 
// Open a new empty graph. Use your own template if needed.
win -t plot;
// Plot output to active graph layer
plotxy rAmp1 plot:=200 color:=color(red) o:=<active>;
plotxy rAmp2 plot:=200 color:=color(blue) o:=<active>;
// Zoom in to show the peak
x1=0;x2=0.5;y1=0;y2=100;
// Mark 11 years with a vertical line 
draw -n peakval -l -v 1/11; 
peakval.linewidth = 3;
peakval.color = color(orange);
// and add a text label
label -n peaklabel \b(11 Year Cycle of Sunspots);
peaklabel.x = peakval.x + 1.1 * peaklabel.dx / 2;
peaklabel.y = (y1 + y2) / 2;
peaklabel.fsize = 30;
  • For more examples, please refer to XF Script Dialog (press F11).

More Information

For more information, please refer to our User Guide.

Related X-Functions

ifft1, fft2, ifft2


Keywords:discrete, amplitude, phase, power, window correction