23.12.2012 Views

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

MATLAB Function Reference Volume 1: A - E - Bad Request

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

conv2<br />

2conv2<br />

Purpose Two-dimensional convolution<br />

Syntax C = conv2(A,B)<br />

C = conv2(hcol,hrow,A)<br />

C = conv2(...,'shape')<br />

Description C = conv2(A,B) computes the two-dimensional convolution of matrices A and<br />

B. If one of these matrices describes a two-dimensional finite impulse response<br />

(FIR) filter, the other matrix is filtered in two dimensions.<br />

2-326<br />

The size of C in each dimension is equal to the sum of the corresponding<br />

dimensions of the input matrices, minus one. That is, if the size of A is [ma,na]<br />

and the size of B is [mb,nb], then the size of C is [ma+mb-1,na+nb-1].<br />

C = conv2(hcol,hrow,A) convolves A separably with hcol in the column<br />

direction and hrow in the row direction. hcol and hrow are both vectors. If hcol<br />

is a column vector and hrow is a row vector, this case is the same as<br />

C = conv2(hcol*hrow,A).<br />

C = conv2(...,'shape') returns a subsection of the two-dimensional<br />

convolution, as specified by the shape parameter:<br />

full Returns the full two-dimensional convolution (default).<br />

same Returns the central part of the convolution of the same size as A.<br />

valid Returns only those parts of the convolution that are computed<br />

without the zero-padded edges. Using this option, C has size<br />

[ma-mb+1,na-nb+1] when all(size(A) >= size(B)). Otherwise<br />

conv2 returns [].<br />

Algorithm conv2 uses a straightforward formal implementation of the two-dimensional<br />

convolution equation in spatial form. If a and b are functions of two discrete<br />

variables, n1 and n2 , then the formula for the two-dimensional convolution of<br />

a and b is<br />

cn ( 1, n2) =<br />

∞<br />

∑<br />

∞<br />

∑ ak ( 1, k2) bn ( 1 – k1, n2 – k2) = – ∞ = – ∞<br />

k 1<br />

k 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!