Close
Close window
Convolution - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Mozilla Firefox.
Maplesoft logo
Maplesoft logo

Online Help

All Products Maple MapleSim


[フレーム] [フレーム]

SignalProcessing

Convolution

compute the finite linear convolution of two arrays of samples

Calling Sequence

Convolution( A, B, options )

Parameters

A

-

Array, Vector, or list of real or complex numeric sample values for first signal

B

-

Array, Vector, or list of real or complex numeric sample values for second signal

Options

algorithm : keyword auto, direct, or fft for the algorithm to use for computation; default is direct

container : Array or Vector, predefined container for holding result

shape : keyword full, same, or valid for the shape of the convolution; default is full

subtype : keyword Array, Vector, Vector[column], or Vector[row] for the subtype of the output; default is Array

Description

The Convolution(A, B) command computes the full convolution of the signals A and B of length M and N respectively, storing the result in a container C of length M+N1 and having datatype float[8] or complex[8], which is then returned.

The full convolution is defined by the formula

Ck=i=1kAiBki+1

for each k from 1 to M+N1, with Aj=0 for M<j and Bj=0 for N<j.

For all choices of shape, the full convolution of size P=M+N1 is computed. When shape=same, the full convolution is trimmed on both sides so that the result is of length Q=M. Note that when the number of elements to be trimmed is odd, one more element will be trimmed from the left side than the right. When shape=valid, the final convolution will be found in a similar manner to the shape=same case, but the value of the size Q will be M when N=0, and maxMN+1&comma;0 otherwise. The valid convolution effectively discards the elements which involve padded zeros for the signals.

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 a 1-D rtable of appropriate size having datatype float[8] (for two real signals) or complex[8] (for one or two complex signals).

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.

Thread Safety

The SignalProcessing[Convolution] command is thread-safe as of Maple 17.

For more information on thread safety, see index/threadsafe .

Examples

>

withSignalProcessing&colon;

Example 1

>

ConvolutionArray5&comma;7&comma;Array2&comma;6&comma;10

−10.16.92.70.

(1)

Example 2

>

aArray1&comma;2&comma;3&comma;datatype=float8

a1.2.3.

(2)
>

bArray1&comma;1&comma;1&comma;1&comma;datatype=float8

b1.−1.1.−1.

(3)
>

Convolutiona&comma;b&comma;algorithm=auto

1.1.2.−2.1.−3.

(4)
>

cArray1..numelemsa+numelemsb1&comma;datatype=float8&colon;

>

Convolutiona&comma;b&comma;container=c&comma;algorithm=direct

1.1.2.−2.1.−3.

(5)
>

c

1.1.2.−2.1.−3.

(6)

Example 3

>

AVectorrow2I&comma;0&comma;5+3I&comma;0&comma;4I

A2I05+3I04I

(7)
>

BVectorrow7&comma;3+10I&comma;92I&comma;1

B−73+10I92I1

(8)
>

C1ConvolutionA&comma;B&comma;algorithm=fft

C1−14.+7.I16.0000000000000+17.I−19.34.I−13.+58.I51.11.I−35.+15.0000000000000I8.+36.I0.+4.00000000000000I

(9)
>

C2`~`roundC1

C2−14.+7.I16.+17.I−19.34.I−13.+58.I51.11.I−35.+15.I8.+36.I0.+4.I

(10)

Example 4

>

AVectorrow2&comma;3&comma;5&comma;7&comma;11

A235711

(11)
>

BVectorrow13&comma;17&comma;19&comma;23

B13171923

(12)
>

ConvolutionA&comma;B&comma;shape=full&comma;subtype=Vectorrow

26.73.154.279.426.435.370.253.

(13)
>

ConvolutionA&comma;B&comma;shape=same&comma;subtype=Vectorrow

154.279.426.435.370.

(14)
>

ConvolutionA&comma;B&comma;shape=valid&comma;subtype=Vectorrow

279.426.

(15)

Compatibility

The SignalProcessing[Convolution] command was introduced in Maple 17.

For more information on Maple 17 changes, see Updates in Maple 17 .

The A and B parameters were updated in Maple 2020.

The algorithm option was introduced in Maple 2020.

For more information on Maple 2020 changes, see Updates in Maple 2020 .

The SignalProcessing[Convolution] command was updated in Maple 2023.

The shape and subtype options were introduced in Maple 2023.

For more information on Maple 2023 changes, see Updates in Maple 2023 .


Download Help Document

AltStyle によって変換されたページ (->オリジナル) /