Table Of Contents

Convolution (G Dataflow)

Version:
    Last Modified: January 9, 2017

    Computes the convolution of two sequences.

    connector_pane_image
    datatype_icon

    x

    The first input sequence.

    This input accepts the following data types:

    • 1D array of double-precision, floating-point numbers
    • 1D array of complex double-precision, floating-point numbers
    • 2D array of double-precision, floating-point numbers
    • 2D array of complex double-precision, floating-point numbers
    datatype_icon

    y

    The second input sequence.

    This input accepts the following data types:

    • 1D array of double-precision, floating-point numbers
    • 1D array of complex double-precision, floating-point numbers
    • 2D array of double-precision, floating-point numbers
    • 2D array of complex double-precision, floating-point numbers
    datatype_icon

    algorithm

    The convolution method to use.

    If x and y are small, the direct method typically is faster. If x and y are large, the frequency domain method typically is faster. Additionally, slight numerical differences can exist between the two methods.

    Name Description
    frequency domain

    Computes the convolution using an FFT-based technique.

    direct

    Computes the convolution using the direct method of linear convolution.

    Computing 1D Convolution with the Frequency Domain Method

    When algorithm is frequency domain, this node completes the following steps to compute the linear convolution:

    1. Pads the end of x and y with zeros to make their lengths M + N - 1, as shown in the following equations.
      x i = { x i i = 0 , 1 , ... , N 1 0 i = N , ... , M + N 2
      y i = { y i i = 0 , 1 , ... , M 1 0 i = M , ... , M + N 2
    2. Calculates the Fourier transform of x' and y' according to the following equations.
      x ( f ) = F F T ( x )
      y ( f ) = F F T ( y )
    3. Multiplies x'(f) by y'(f) and calculates the inverse Fourier transform of the product. The result is the linear convolution of x and y, as shown in the following equation.
      x * y = I F F T ( x ( f ) y ( f ) )

    Computing 2D Convolution with the Frequency Domain Method

    When algorithm is frequency domain, this node completes the following steps to compute the two-dimensional convolution:

    1. Pads the end of x and y with zeros to make their sizes (M1 + M2 - 1)-by-(N1 + N2 - 2), as shown in the following equations.
      x i j = { x i j i = 0 , 1 , ... , M 1 1 , j = 0 , 1 , ... , N 1 1 0 i = M 1 , ... , M 1 + M 2 2 , j = N 1 , ... , N 1 + N 2 2
      y i j = { y i j i = 0 , 1 , ... , M 2 1 , j = 0 , 1 , ... , N 2 1 0 i = M 2 , ... , M 1 + M 2 2 , j = N 2 , ... , N 1 + N 2 2
    2. Calculates the Fourier transform of x' and y' according to the following equations.
      x ( f ) = F F T ( x )
      y ( f ) = F F T ( y )
    3. Multiplies x'(f) by y'(f) and calculates the inverse Fourier transform of the product. The result is the two-dimensional convolution of x and y, as shown in the following equation.
      x * y = I F F T ( x ( f ) y ( f ) )

    Computing 1D Convolution with the Direct Method

    When algorithm is direct, this node uses the following equation to perform the discrete implementation of the linear convolution and obtain the elements of x * y.

    h i = k = 0 N 1 x k y i k

    for i = 0, 1, 2, ... , M+N-2

    where

    • h is x * y
    • N is the number of elements in x
    • M is the number of elements in y
    • the indexed elements outside the ranges of x and y are equal to 0, as shown in the following relationships:
    x j = 0 , j < 0 , or j N

    and

    y j = 0 , j < 0 , or j M

    Computing 2D Convolution with the Direct Method

    When algorithm is direct, this node uses the following equation to compute the two-dimensional convolution of the input matrices x and y.

    h ( i , j ) = m = 0 M 1 1 n = 0 N 1 1 x ( m , n ) y ( i m , j n ) k

    for i = 0, 1, 2, ... , M1+M2-2 and j = 0, 1, 2, ... , N1+N2-2

    where

    • h is x * y
    • M1 is the number of rows of matrixx
    • N1 is the number of columns of matrix x
    • M2 is the number of rows of matrixy
    • N2 is the number of columns of matrix y
    • the indexed elements outside the ranges of x and y are equal to 0, as shown in the following relationships:
    x ( m , n ) = 0 , m < 0 , or m M 1 or n < 0 or n N 1

    and

    y ( m , n ) = 0 , m < 0 , or m M 2 or n < 0 or n N 2

    Default: frequency domain

    datatype_icon

    error in

    Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

    Default: No error

    datatype_icon

    x * y

    The convolution of the two input sequences.

    datatype_icon

    error out

    Error information. The node produces this output according to standard error behavior.

    Algorithm for Calculating the 1D Convolution

    The linear convolution of the signals x(t) and y(t) is defined as:

    h ( t ) = x ( t ) * y ( t ) = x ( τ ) y ( t τ ) d τ

    where the symbol * denotes linear convolution.

    This node computes the linear convolution, not the circular convolution. However, because x ( t ) * y ( t ) N X ( f ) Y ( f ) is a Fourier transform pair, where x ( t ) * y ( t ) N is the circular convolution of x(t) and y(t), you can create a circular version of the convolution.

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: Not supported


    Recently Viewed Topics