2.70 Linear convolution of 2 sequences
Problem: Given 2 sequences \(x_{1}[n]\) and \(x_{2}[m]\), determine the linear convolution of the 2 sequences.
Assume \(x_{1}=[1,2,3,4,5]\) and \(x_{2}=[3,4,5]\).
| Mathematica
Clear ["Global`*"]
x1 = {1, 2, 3, 4, 5};
x2 = {4, 5, 6};
ListConvolve[x2, x1, {1, -1}, 0]
|
{4, 13, 28, 43, 58, 49, 30}
|
| Matlab
clear all; close all;
x1=[1 2 3 4 5];
x2=[4 5 6];
conv(x2,x1)
|
4 13 28 43 58 49 30
|
| Maple
In Maple, had to convert lists to Array first to use Convolution.
This is not good. The function should have accepted lists also.
Maple 2021.
x1 := [1, 2, 3, 4, 5];
x2 := [4, 5, 6];
#note, need to convert list to Array. Why?
SignalProcessing:-Convolution(convert(x1,Array),convert(x2,Array))
|
\[ \left [\begin {array}{ccccccc} 4.0 & 13.0 & 28.0 & 43.0 & 58.0 & 49.0 & 30.0 \end {array}\right ] \] |