SignalProcessing
Convolution
compute the finite linear convolution of two arrays of samples
Calling Sequence
Parameters
Options
Description
Thread Safety
Examples
Compatibility
Convolution(A, B)
A, B
-
Arrays of real or complex numeric sample values
container : Array, predefined Array for holding result
algorithm : symbol, algorithm to use for computation
The Convolution(A, B) command computes the convolution of the Arrays A and B of length M and N respectively, storing the result in a Array C of length M+N−1 and having datatype float[8] or complex[8], which is then returned.
The convolution is defined by the formula
Ck=∑i=1k⁡Ai⁢Bk−i+1
for each k from 1 to M+N−1, with Aj=0 for M<j and Bj=0 for N<j.
Before the code performing the computation runs, A and B are converted to datatype float[8] (if the values are all real-valued) or complex[8] (if all the values are complex-valued, but not all real-valued) if they do not have that datatype already. For this reason, it is most efficient if A and B have one of these datatypes beforehand.
If either A or B is an rtable that is not a 1-D Array, it is accepted by the command and converted to an Array. Should this not be possible, an error will be thrown.
If the container=C option is provided, then the results are put into C and C is returned. With this option, no additional memory is allocated to store the result. The container must be an Array of size M+N−1 having datatype float[8] or complex[8].
The algorithm=name option can be used to specify the algorithm used for computing the convolution. Supported algorithms:
auto - automatically choose the fastest algorithm based on input.
direct - use direct convolution formula for computation. This is the default.
fft - use an algorithm based on the Fast Fourier Transform (FFT). This is a much faster algorithm than the direct formula for large samples, but numerical roundoff can cause significant numerical artifacts, especially when the result has a large dynamic range.
The SignalProcessing[Convolution] command is thread-safe as of Maple 17.
For more information on thread safety, see index/threadsafe.
with( SignalProcessing ):
Example 1
Convolution( Array( [ 5, 7 ] ), Array( [ -2, 6, 10 ] ) );
−10.16.92.70.
Example 2
a := Array( [ 1, 2, 3 ], 'datatype' = 'float'[ 8 ] );
a≔1.2.3.
b := Array( [ 1, -1, 1, -1 ], 'datatype' = 'float'[ 8 ] );
b≔1.−1.1.−1.
Convolution( a, b, 'algorithm' = 'auto' );
1.1.2.−2.1.−3.
c := Array( 1 .. numelems( a ) + numelems( b ) - 1, 'datatype' = 'float'[ 8 ] ):
Convolution( a, b, 'container' = c, 'algorithm' = 'direct' );
c;
Example 3
A := Vector[row]( [ 2 - I, 0, 5 + 3 * I, 0, 4 * I ] );
A≔2−I05+3⁢I04⁢I
B := Vector[row]( [ -7, 3 + 10 * I, 9 - 2 * I, 1 ] );
B≔−73+10⁢I9−2⁢I1
C1 := Convolution( A, B, 'algorithm' = 'fft' );
C1≔−14.+7.⁢I16.0000000000000+17.⁢I−19.−34.⁢I−13.+58.⁢I51.−11.⁢I−35.+15.0000000000000⁢I8.+36.⁢I4.00000000000000⁢I
C2 := round~( C1 );
C2≔−14.+7.⁢I16.+17.⁢I−19.−34.⁢I−13.+58.⁢I51.−11.⁢I−35.+15.⁢I8.+36.⁢I4.⁢I
The SignalProcessing[Convolution] command was introduced in Maple 17.
For more information on Maple 17 changes, see Updates in Maple 17.
The SignalProcessing[Convolution] command was updated in Maple 2020.
The A, B parameter was updated in Maple 2020.
The algorithm option was introduced in Maple 2020.
For more information on Maple 2020 changes, see Updates in Maple 2020.
See Also
SignalProcessing[AutoCorrelation]
SignalProcessing[CrossCorrelation]
Download Help Document
What kind of issue would you like to report? (Optional)