series_fft()series_fft()

对系列应用快速傅立叶变换 (FFT)。Applies the Fast Fourier Transform (FFT) on a series.

series_fft() 函数接受时间/空间域中的一系列复数,使用快速傅立叶变换将其变换为频域。The series_fft() function takes a series of complex numbers in the time/spatial domain and transforms it to the frequency domain using the Fast Fourier Transform. 变换后的复数序列表示原始序列中出现的频率的幅值和相位。The transformed complex series represents the magnitude and phase of the frequencies appearing in the original series. 使用互补函数 series_ifft 从频域变换回时间/空间域。Use the complementary function series_ifft to transform from the frequency domain back to the time/spatial domain.

语法Syntax

series_fft(x_real [, x_imaginary])series_fft(x_real [, x_imaginary])

参数Arguments

  • x_real:数值的动态数组,表示要变换的序列的实数部分。x_real: Dynamic array of numeric values representing the real component of the series to transform.
  • x_imaginary:一个类似的动态数组,表示序列的虚数部分。x_imaginary: A similar dynamic array representing the imaginary component of the series. 此参数是可选参数,仅当输入序列包含复数时才应指定它。This parameter is optional and should be specified only if the input series contains complex numbers.

返回Returns

此函数以两个序列返回复合反向 fft。The function returns the complex inverse fft in two series. 第一个序列表示实数部分,第二个序列表示虚数部分。The first series for the real component and the second one for the imaginary component.

示例Example

  • 生成一个复杂的序列,其中的实数部分和虚数部分是不同频率的纯正弦波。Generate a complex series, where the real and imaginary components are pure sine waves in different frequencies. 使用 FFT 将其变换为频域:Use FFT to transform it to the frequency domain:

    let sinewave=(x:double, period:double, gain:double=1.0, phase:double=0.0)
    {
        gain*sin(2*pi()/period*(x+phase))
    }
    ;
    let n=128;      //  signal length
    range x from 0 to n-1 step 1 | extend yr=sinewave(x, 8), yi=sinewave(x, 32)
    | summarize x=make_list(x), y_real=make_list(yr), y_imag=make_list(yi)
    | extend (fft_y_real, fft_y_imag) = series_fft(y_real, y_imag)
    | render linechart with(ysplit=panels)
    

    此查询返回 fft_y_real 和 fft_y_imag:This query returns fft_y_real and fft_y_imag:

    序列 fft

  • 将序列变换为频域,然后应用反向变换以返回原始序列:Transform a series to the frequency domain, and then apply the inverse transform to get back the original series:

    let sinewave=(x:double, period:double, gain:double=1.0, phase:double=0.0)
    {
        gain*sin(2*pi()/period*(x+phase))
    }
    ;
    let n=128;      //  signal length
    range x from 0 to n-1 step 1 | extend yr=sinewave(x, 8), yi=sinewave(x, 32)
    | summarize x=make_list(x), y_real=make_list(yr), y_imag=make_list(yi)
    | extend (fft_y_real, fft_y_imag) = series_fft(y_real, y_imag)
    | extend (y_real2, y_image2) = series_ifft(fft_y_real, fft_y_imag)
    | project-away fft_y_real, fft_y_imag   //  too many series for linechart with panels
    | render linechart with(ysplit=panels)
    

    此查询返回 y_real2 和 *y_imag2(与 y_real 和 y_imag 相同):This query returns y_real2 and *y_imag2, which are the same as y_real and y_imag:

    序列 ifft