Products & Services Solutions Academia Support User Community Company

Learn more about Signal Processing Blockset   

Convolution - Compute convolution of two inputs

Library

Signal Operations

dspsigops

Description

The Convolution block convolves the first dimension of a sample-based N-D input array u, with the first dimension of a sample-based N-D input array v. The block can also independently convolve a sample-based vector with the first-dimension of an N-D input array. For frame-based inputs, the Convolution block convolves analogous columns of an Mu-by-N input matrix u and an Mv-by-N input matrix v. The Convolution block can also independently convolve a single-channel frame-based column vector with each column of a multiple-channel frame-based matrix.

The frame status of both inputs to the Convolution block must be the same. The output of the block is always sample-based.

The Convolution block accepts real and complex floating-point and fixed-point inputs except for complex unsigned fixed-point inputs. Fixed-point signals are not supported for the frequency domain.

Convolution with Signal Processing Blockset Blocks

The general equation for convolution is

There are two Signal Processing Blockset blocks that can be used for this purpose:

The Convolution block assumes that all of u and h are available at each Simulink time step, and computes the entire convolution at every one.

The Digital Filter block can be used for convolving signals in situations where all of h is available at each time step, but u is a sequence that comes in over the life of the simulation. When you use the Digital Filter block, the convolution is computed only once. To convolve inputs with the Digital Filter block, you must set the Transfer function type to FIR (all zeros).

Use the following questions to help you determine which block best fits your needs:

QuestionAnswerRecommended Block(s)

How many convolutions do you intend to perform?

Many convolutions, one at each time step

  • Convolution block

One convolution over the life of the simulation

  • Convolution block

  • Digital Filter block (in FIR mode)

How long are your input sequences?

Both sequences have a finite length

  • Convolution block

  • Digital Filter block (in FIR mode)

One sequence has an infinite (not predetermined) length

  • Digital Filter block (in FIR mode)

How many of the inputs are scalar sample-based streams?

None

  • Convolution block

  • Digital Filter block (in FIR mode)

One or both

  • Buffer block followed by the Convolution block

  • Digital Filter block (in FIR mode)

Convolving Frame-Based Inputs

When the inputs to the Convolution block are a frame based Mu-by-N input matrix u and an Mv-by-N input matrix v, the output, y, is a sample-based (Mu+Mv–1)-by-N matrix whose jth column has elements

Inputs u and v are zero when indexed outside of their valid ranges. When both inputs are real, the output is real; when one or both inputs are complex, the output is complex.

When one input is a column vector (single channel) and the other is a matrix (multiple channels), the single-channel input is independently convolved with each channel of the multichannel input. For example, when u is a Mu-by-1 column vector and v is an Mv-by-N matrix, the output is an (Mu+Mv–1)-by-N matrix whose jth column has elements

Convolving Sample-Based Inputs

The Convolution block supports sample-based N-D input arrays. The convolution of N-D array input is always computed across the first dimension. If both inputs are N-D arrays, the size of their first dimension can differ, but the size of all other dimensions must be equal. For example, when u is an Mu-by-N-by-P array, and v is an Mv-by-N-by-P array, the output is an (Mu+Mv–1)-by-N-by-P array.

When one input is an N-D sample-based array and the other is a vector, the vector is independently convolved with the first dimension of the N-D input. For example, when u is a Mu-by-1 column vector and v is an Mv-by-N-by-P array, the output is an (Mu+Mv–1)-by-N-by-P array.

The Convolution block also accepts two vector inputs. When u and v are sample-based vectors with lengths Mu and Mv, the Convolution block performs the vector convolution

The dimensions of the sample-based output vector are determined by the dimensions of the input vectors:

Fixed-Point Data Types

The following diagram shows the data types used within the Convolution block for fixed-point signals (time domain only).

You can set the product output, accumulator, and output data types in the block dialog as discussed in the next section.

The output of the multiplier is in the product output data type when the input is real. When the input is complex, the result of the multiplication is in the accumulator data type. For details on the complex multiplication performed, see Multiplication Data Types.

Dialog Box

The Main pane of the Convolution block dialog appears as follows.

Computation domain

Set the domain in which the block computes convolutions:

  • Time — The block computes in the time domain, which minimizes memory use.

  • Frequency — The block computes in the frequency domain, which might require fewer computations than computing in the time domain, depending on the input length.

  • Fastest — The block computes in the domain, which minimizes the number of computations.

The Data type attributes pane of the Convolution block dialog appears as follows.

Rounding mode

Select the rounding mode for fixed-point operations.

Overflow mode

Select the overflow mode for fixed-point operations.

Product output data type

Specify the product output data type. See Fixed-Point Data Types and Multiplication Data Types for illustrations depicting the use of the product output data type in this block. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • An expression that evaluates to a valid data type, for example, fixdt([],16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Product output data type parameter.

See Using the Data Type Assistant for more information.

Accumulator data type

Specify the accumulator data type. See Fixed-Point Data Types for illustrations depicting the use of the accumulator data type in this block. You can set this parameter to:

  • A rule that inherits a data type, for example, Inherit: Inherit via internal rule

  • An expression that evaluates to a valid data type, for example, fixdt([],16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Accumulator data type parameter.

See Using the Data Type Assistant for more information.

Output data type

Specify the output data type. See Fixed-Point Data Types for illustrations depicting the use of the output data type in this block. You can set it to:

  • A rule that inherits a data type, for example, Inherit: Same as accumulator

  • An expression that evaluates to a valid data type, for example, fixdt([],16,0)

Click the Show data type assistant button to display the Data Type Assistant, which helps you set the Output data type parameter.

See Specifying Block Output Data Types for more information.

Minimum

Specify the minimum value that the block should output. The default value, [], is equivalent to -Inf. Simulink software uses this value to perform:

Maximum

Specify the maximum value that the block should output. The default value, [], is equivalent to Inf. Simulink software uses this value to perform:

Lock scaling against changes by the autoscaling tool

Select this parameter to prevent any fixed-point scaling you specify in this block mask from being overridden by the autoscaling tool in the Fixed-Point Tool.

Supported Data Types

PortSupported Data Types

Input

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

Output

  • Double-precision floating point

  • Single-precision floating point

  • Fixed point (signed and unsigned)

  • 8-, 16-, and 32-bit signed integers

  • 8-, 16-, and 32-bit unsigned integers

See Also

Correlation

Signal Processing Blockset

conv

MATLAB

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS