Convolution and polynomial multiplication
Polynomial Multiplication via Convolution
v containing the coefficients of the polynomials and .
u = [1 0 1]; v = [2 7];
Use convolution to multiply the polynomials.
w = conv(u,v)
w = 1×4 2 7 2 7
w contains the polynomial coefficients for .
Create two vectors and convolve them.
u = [1 1 1]; v = [1 1 0 0 0 1 1]; w = conv(u,v)
w = 1×9 1 2 2 1 0 1 2 2 1
The length of
length(u)+length(v)-1, which in this example is
Central Part of Convolution
Create two vectors. Find the central part of the convolution of
v that is the same size as
u = [-1 2 3 -2 0 1 2]; v = [2 4 -1 1]; w = conv(u,v,'same')
w = 1×7 15 5 -9 7 6 7 -1
w has a length of
7. The full convolution would be of length
length(u)+length(v)-1, which in this example would be 10.
u,v — Input vectors
Input vectors, specified as either row or column vectors. The
v can be different
lengths or data types.
v are of type
then the output is of type
inputs to type
double and returns type
Complex Number Support: Yes
shape — Subsection of convolution
'full' (default) |
Subsection of the convolution, specified as
Full convolution (default).
Central part of the convolution of the same size as
Only those parts of the convolution that are computed
without the zero-padded edges. Using this option,
The convolution of two vectors,
represents the area of overlap under the points as
u. Algebraically, convolution is the same
operation as multiplying polynomials whose coefficients are the elements
m = length(u) and
n = length(v) .
w is the vector of length
The sum is over all the values of
lead to legal subscripts for
w(1) = u(1)*v(1) w(2) = u(1)*v(2)+u(2)*v(1) w(3) = u(1)*v(3)+u(2)*v(2)+u(3)*v(1) ... w(n) = u(1)*v(n)+u(2)*v(n-1)+ ... +u(n)*v(1) ... w(2*n-1) = u(n)*v(n)
Calculate with arrays that have more rows than fit in memory.
Usage notes and limitations:
vmust be column vectors.
'full'(default), then only one of
vcan be a tall array.
vcannot be a tall array.
For more information, see Tall Arrays.
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
For information about C/C++ code generation limitations, see Variable-Sizing Restrictions for Code Generation of Toolbox Functions (MATLAB Coder).
GPU Code Generation
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.
Run code in the background using MATLAB®
backgroundPool or accelerate code with Parallel Computing Toolbox™
This function fully supports thread-based environments. For more information, see Run MATLAB Functions in Thread-Based Environment.
Accelerate code by running on a graphics processing unit (GPU) using Parallel Computing Toolbox™.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
Partition large arrays across the combined memory of your cluster using Parallel Computing Toolbox™.
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).
Introduced before R2006a