Contents Previous Next Subchapters Current Chapters-> prctile ftail tpdf ttail ittail cnormal inormal rand snormal seed colmad colmse colrange colmode kurtosis skewness randperm ranseed unifm0v1 unirnd normrnd exprnd gamrnd cauchyrnd gumbelrnd laplacernd lognrnd wblrnd binornd poissrnd exppdf expcdf normpdf unifpdf unifcdf wblpdf wblcdf colcor colcov colmean colstd colmax rowmax colsum rowsum colnorm rownorm median colmedian colmead colvar corr conv conv2 sum cumsum prod cumprod Parent Chapters-> Omatrix6 statistics conv2 Search Tools-> contents reference index search

Two Dimensional Convolution Of Matrices Using FFT
 Syntax f` = conv2(`g`, `h`)` See Also conv , fft2d

Description
Returns a matrix that is the two dimensional convolution of g with h, where g and h are integer, real, double-precision, or complex matrices. We use the following notation to specify the return matrix f:
 Notation Meaning `mf` number of rows in f `nf` number of columns in f `mg` number of rows in g `ng` number of columns in g `mh` number of rows in h `nh` number of columns in h
If `1 < i < mh` and `1 < j < nh` we define ```      H(i, j) = h                 i,j ```otherwise `H(i, j)` is zero. The return value f has the same type as g and is defined by ```      mf = mg + mh - 1      nf = ng + nh - 1            mg  ng            --- ---       f   = >   >    g    H(m-i+1, n-j+1)       m,n  --- ---   i,j            i=1 j=1 ```An two dimensional fft is used to compute the convolution.

Example ```      g = { ...           [1., 1.], ...           [1., 1.]  ...      }      conv2(g, g) ``` returns ```      {      [1 , 2 , 1], ...      [2 , 4 , 2], ...      [1 , 2 , 1] ...      } ```