MATLAB Function Reference | Search  Help Desk |
conv2 | Examples See Also |
C = conv2(A,B)
C = conv2(hcol,hrow,A)
C = conv2(...,'shape
')
C = conv2(A,B)
computes the two-dimensional convolution of matrices A
and B
. If one of these matrices describes a two-dimensional FIR filter, the other matrix is filtered in two dimensions.
The size of C
in each dimension is equal to the sum of the corresponding dimensions of the input matrices, minus one. That is, if the size of A
is [ma,na]
and the size of B
is [mb,nb]
, then the size of C
is [ma+mb-1,na+nb-1]
.
C = conv2(hcol,hrow,A)
convolves A
separably with hcol
in the column direction and hrow
in the row direction. hcol
and hrow
should both be vectors.
C = conv2(...,'shape
')
returns a subsection of the two-dimensional convolution, as specified by the shape
parameter:s = [1 2 1; 0 0 0; -1 -2 -1];These commands extract the horizontal edges from a raised pedestal:
A = zeros(10); A(3:7,3:7) = ones(5); H = conv2(A,s); mesh(H)These commands display first the vertical edges of
A
, then both horizontal and vertical edges.
V = conv2(A,s'); mesh(V) mesh(sqrt(H.^2+V.^2))
conv
Convolution and polynomial multiplication
deconv
Deconvolution and polynomial division
filter2
Two-dimensional digital filtering
xcorr2
Two-dimensional cross-correlation (see Signal
Processing Toolbox)