Convolution of two inputs
DSP System Toolbox / Signal Operations
The Convolution block convolves the first dimension of an ND input array u with the first dimension of an ND input array v. The block can also convolve a column vector with the firstdimension of an ND input array.
The general equation for convolution is:
$$y(k)={\displaystyle \sum _{n}^{}u(nk)v(k)}$$
Two DSP System Toolbox™ blocks can be used for convolving two input signals:
Convolution
Discrete FIR Filter (Simulink)
The Convolution block assumes that all elements of u and v are available at each Simulink^{®} time step and computes the entire convolution at every step.
The Discrete FIR Filter block can be used for convolving signals in situations where all elements of v is available at each time step, but u is a sequence that comes in over the life of the simulation. When you use the Discrete FIR Filter block, the convolution is computed only once.
To determine which block best fits your needs, see Selecting the Appropriate Convolution Block.
Port_1
— First input signalFirst input u specified as a scalar, vector, matrix, or ND array. When both inputs are real, the output is real. When one or both inputs are complex, the output is complex. All the input port dimensions for both the inputs, except the first dimension, must have the same value.
Inputs u and v are zero when indexed outside their valid ranges.
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
 fixed point
Complex Number Support: Yes
Port_2
— Second input signalSecond input v specified as a scalar, vector, matrix, or ND array. When both inputs are real, the output is real. When one or both inputs are complex, the output is complex. All the input port dimensions for both the inputs, except the first dimension, must have the same value.
Inputs u and v are zero when indexed outside their valid ranges.
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
 fixed point
Complex Number Support: Yes
Port_1
— Output signalConvolved signal, returned as a scalar, vector, matrix, or ND array depending on the input signals. When both inputs are real, the output is real. When one or both inputs are complex, the output is complex. Inputs u and v are zero when indexed outside of their valid ranges. For more details on how the convolved signal changes based on the inputs, see More About.
Data Types: single
 double
 int8
 int16
 int32
 uint8
 uint16
 uint32
 fixed point
Complex Number Support: Yes
Computation domain
— Computation domainTime
(default)  Frequency
 Fastest
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 that minimizes the number of computations.
Fixedpoint signals are only supported in the time domain. When
inputting fixedpoint signals, make sure you set the
Computation domain parameter to
Time
.
Rounding mode
— Method of rounding operationFloor
(default)  Ceiling
 Convergent
 Nearest
 Round
 Simplest
 Zero
Specify the rounding mode for fixedpoint operations as one of the following:
Floor
Ceiling
Convergent
Nearest
Round
Simplest
Zero
For more details, see Rounding Modes.
Note
The Rounding mode and Saturate on integer overflow parameters have no effect on numerical results when all these conditions are met:
Product output data type is
Inherit: Inherit via internal
rule
.
Accumulator data type is
Inherit: Inherit via internal
rule
.
Output data type is
Inherit: Same as
accumulator
.
With these datatype settings, the block operates in a fullprecision mode.
Saturate on integer overflow
— Method of overflow actionoff
(default)  on
When you select this parameter, the block saturates the result of its fixedpoint operation. When you clear this parameter, the block wraps the result of its fixedpoint operation. For details on saturate and wrap, see Overflow Handing for fixedpoint operations.
Note
The Rounding mode and Saturate on integer overflow parameters have no effect on numerical results when all these conditions are met:
Product output data type is
Inherit: Inherit via internal
rule
.
Accumulator data type is
Inherit: Inherit via internal
rule
.
Output data type is
Inherit: Same as
accumulator
.
With these datatype settings, the block operates in a fullprecision mode.
Product output
— Product output data typeInherit: Inherit via internal
rule
(default)  Inherit: Same as first input
 fixdt([],16,0)
Product output specifies the data type of the output of a product operation in the Convolution block.
Inherit: Inherit via internal rule
— The block inherits the product output data type based
on an internal rule. For more information on this rule, see
Inherit via Internal Rule.
Inherit: Same as first input
— The block specifies the product output data type to be
the same as the first input data type.
fixdt([],16,0)
— The block
specifies an autosigned, binarypoint, scaled, fixedpoint data
type with a word length of 16 bits and a fraction length of
0.
Alternatively, you can set the Product output data type by using the Data Type Assistant. To use the assistant, click the Show data type assistant button.
For more information on the data type assistant, see Specify Data Types Using Data Type Assistant (Simulink).
For more information on the product output data type, see Multiplication Data Types and FixedPoint Conversion in Extended Capabilities.
Accumulator
— Data type of accumulatorInherit: Inherit via internal
rule
(default)  Inherit: Same as first input
 Inherit: Same as product output
 fixdt([],16,0)
Accumulator specifies the data type of the output of an accumulation operation in the Convolution block.
Inherit: Inherit via internal rule
— The block inherits the accumulator data type based on
an internal rule. For more information on this rule, see Inherit via Internal Rule.
Inherit: Same as first input
— The block specifies the accumulator data type to be the
same as the first input data type.
Inherit: Same as product output
— The block specifies the accumulator data type to be the
same as the product output data type.
fixdt([],16,0)
— The block
specifies an autosigned, binarypoint, scaled, fixedpoint data
type with a word length of 16 bits and a fraction length of
0.
Alternatively, you can set the Accumulator data type by using the Data Type Assistant. To use the assistant, click the Show data type assistant button.
For more information on the data type assistant, see Specify Data Types Using Data Type Assistant (Simulink).
For a diagrammatic representation on how to use the accumulator data type in this block, see FixedPoint Conversion in Extended Capabilities.
Output
— Data type of outputInherit: Same as
accumulator
(default)  Inherit: Same as input
 Inherit: Same as product output
 fixdt([],16,0)
Output specifies the data type of the output of the Convolution block.
Inherit: Same as accumulator
— The block specifies the output data type to be the same
as the accumulator data type.
Inherit: Same as first input
— The block specifies the output data type to be the same
as the first input data type.
Inherit: Same as product output
— The block specifies the output data type to be the same
as the product output data type.
fixdt([],16,0)
— The block
specifies an autosigned, binarypoint, scaled, fixedpoint data
type with a word length of 16 bits and a fraction length of
0.
Alternatively, you can set the Output data type by using the Data Type Assistant. To use the assistant, click the Show data type assistant button.
For more information, see Control Data Types of Signals (Simulink).
For more information on the output data type, see FixedPoint Conversion in Extended Capabilities.
Output Minimum
— Minimum value that block can output[]
(default)  scalarSpecify the minimum value the block can output. Simulink uses this minimum value to perform:
Simulation range checking. See Specify Signal Ranges (Simulink).
Automatic scaling of fixedpoint data types.
Output Maximum
— Maximum value that block can output[]
(default)  scalarSpecify the maximum value the block can output. Simulink uses this maximum value to perform:
Simulation range checking. See Specify Signal Ranges (Simulink).
Automatic scaling of fixedpoint data types.
Lock data type settings against changes by the fixedpoint tools
— Prevent fixedpoint tools from overriding data typesoff
(default)  on
Select this parameter to prevent the fixedpoint tools from overriding the data types you specify in the block dialog box.
Data Types 

Direct Feedthrough 

Multidimensional Signals 

VariableSize Signals 

ZeroCrossing Detection 

Question  Answer  Recommended Block(s) 

How many convolutions do you intend to perform?  Many convolutions, one at each time step 

One convolution over the life of the simulation 
 
How long are your input sequences?  Both sequences have a finite length 

One sequence has an infinite (not predetermined) length 
 
How many of the inputs are scalar streams?  None 

One or both 

The block always computes the convolution of two ND input arrays along the first dimension. When both inputs are ND 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 M_{u}byNbyP array and v is an M_{v}byNbyP array, the output is an (M_{u}+M_{v}–1)byNbyP array.
When u is a M_{u}byN matrix and v is an M_{v}byN matrix, the output y is a (M_{u}+M_{v}–1)byN matrix whose jth column has these elements
$$\begin{array}{cc}{y}_{i,j}={\displaystyle \sum _{k=0}^{\mathrm{max}({M}_{u},{M}_{v})1}{u}_{k,j}{v}_{\left(ik\right),j}}& 0\le i\le \left({M}_{u}+{M}_{v}2\right)\end{array}$$
Inputs u and v are zero when indexed outside 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 and the other is an ND array, the block independently convolves the vector with the first dimension of the ND input array. For example, when u is a M_{u}by1 column vector and v is an M_{v}byN matrix, the output is an (M_{u}+M_{v}–1)byN matrix whose jth column has these elements:
$$\begin{array}{cc}{y}_{i,j}={\displaystyle \sum _{k=0}^{\mathrm{max}({M}_{u},{M}_{v})1}{u}_{k}{v}_{\left(ik\right),j}}& 0\le i\le \left({M}_{u}+{M}_{v}2\right)\end{array}$$
The Convolution block also accepts two column vector inputs. When u and v are column vectors with lengths M_{u} and M_{v}, the Convolution block performs the vector convolution with lengths M_{u} and M_{v} such that:
$$\begin{array}{cc}{y}_{i}={\displaystyle \sum _{k=0}^{\mathrm{max}({M}_{u},{M}_{v})1}{u}_{k}{v}_{\left(ik\right)}}& 0\le i\le \left({M}_{u}+{M}_{v}2\right)\end{array}$$
The output is a (M_{u}+M_{v}–1)by1 column vector.
This diagram shows the data types used within the Convolution block for fixedpoint signals (time domain only).
You can set the product output, accumulator, and output data types in the block dialog as discussed in Parameters.
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 how the multiplication operation is performed, see Multiplication Data Types.
Note
When one or both of the inputs are signed fixedpoint signals, all internal block data types are signed fixed point. The internal block data types are unsigned fixed point only when both inputs are unsigned fixedpoint signals.
Ha hecho clic en un enlace que corresponde a este comando de MATLAB:
Ejecute el comando introduciéndolo en la ventana de comandos de MATLAB. Los navegadores web no admiten comandos de MATLAB.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
Select web siteYou can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.