|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
/ N5 V' o/ Y. o; ?7 P3 O% z2 C
. T) G5 a, o L3 W4 Z7 }matlab中的conv2是用于对二维数据进行卷积运算,有三个参数可供选择,下面是help content of conv2. G3 z/ `6 e7 P3 B7 V& y
4 B; M- ~& z- H" x; g ~conv2 Two dimensional convolution.
. w1 |* N: G3 x4 l0 x' z
2 r% x- I* a k" X5 j C = conv2(A, B) peRForms the 2-D convolution of matrices A and B.
, Z. O4 p/ K! t5 b" V# q If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then& e% G1 \5 _7 P1 S; q c* k
mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).
& I/ R- F' ~( Z% k ; p2 e% w) o2 h: q
C = conv2(H1, H2, A) first convolves each column of A with the vector
" |- v# Z0 x! d/ F, k" O% L H1 and then convolves each row of the result with the vector H2. If
1 k, p5 P( Z" Q( |/ Z- p6 f n1 = length(H1), n2 = length(H2), and [mc,nc] = size(C) then5 k; s' n3 g' a% M* u
mc = max([ma+n1-1,ma,n1]) and nc = max([na+n2-1,na,n2]).* O1 }$ L0 Z6 W2 n
conv2(H1, H2, A) is equivalent to conv2(H1(:)*H2(:).', A) up to
. q9 W$ E2 x" m& p round-off.; \ b" w3 Q5 n) F K* q
" z8 l$ G# r; n8 D) s
C = conv2(..., SHAPE) returns a subsection of the 2-D
0 \8 ~. F2 f: @( Z convolution with size specified by SHAPE:
4 G- c8 j: Y d: _. D4 C 'full' - (default) returns the full 2-D convolution,
3 ]! q& L0 ~, Z- h$ z. M) D& ?2 c 'same' - returns the central part of the convolution
4 X2 j$ j% E/ \: M3 V) R that is the same size as A.3 J' o/ Z4 e0 g: V- ]
'valid' - returns only those parts of the convolution
5 U; n: E; ?* N& B( d6 u& i/ l that are computed without the zero-padded edges.
: b& ` R& j, L4 X& u, ~+ F size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).7 z" S# b3 ~6 ^9 x, f0 I# N
P; _: \7 Q" y* T- G2 y2 a
/ x& `- F! |3 h& L
关于full, same以及valid三种参数的区别,如下面的实例所示:/ m6 @! ^3 I2 C% k s, K
' g8 B* D' @ O$ a. Wfull6 U n; w- _6 i1 {- z% N
E8 V, ^7 V1 e+ }
9 [3 U0 G0 G- ` I. J; z
5 p! Z# b! s3 j- ~4 m
( M) _$ q. W' m2 r5 W! k- rsame' r! |" T9 Z, N2 U9 p
* M( e% Z; j3 t% s/ d
+ H. H4 {6 W- R$ {; z; y; ?3 j4 d6 E* k5 \( w; K
( [. a3 G; Q7 C7 U: H0 w3 D" hvalid% S9 u& Z7 N$ v5 M2 ]% i' }
2 C5 p3 B: s- d! z
% O$ H5 F" R# F: G. q+ e
7 ]$ h% m6 ~. G4 U0 \( \# d
+ i+ o' Y2 e6 B5 I |
|