|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
7 m+ V9 `. F2 i e( F( }! C- B2 X' Q' H+ s5 n
matlab中的conv2是用于对二维数据进行卷积运算,有三个参数可供选择,下面是help content of conv2+ V; i- b4 |. {% |1 T; B2 f
f! r- @5 L# M* o; n- @( |* \( @
conv2 Two dimensional convolution.; I; z9 Z$ ]& [& x2 N5 @% M: X
& s2 F2 K- F1 Z- V5 N C = conv2(A, B) peRForms the 2-D convolution of matrices A and B.0 ~- y3 |4 @6 Q3 ~1 M
If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then9 Q" t! n6 |" G; G9 v
mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).
8 c% ] q! F% H2 [4 z & I' l: I; e6 _& s- B# K
C = conv2(H1, H2, A) first convolves each column of A with the vector
2 z2 _0 Z6 j& b6 Z( ^8 M7 c H1 and then convolves each row of the result with the vector H2. If1 {9 l9 n# J/ G2 `) M
n1 = length(H1), n2 = length(H2), and [mc,nc] = size(C) then' Q+ J& J+ Z& I( E
mc = max([ma+n1-1,ma,n1]) and nc = max([na+n2-1,na,n2]). Z3 ?( j( M% Z6 R2 H/ \8 z
conv2(H1, H2, A) is equivalent to conv2(H1(:)*H2(:).', A) up to
* h- P) D# S& |8 p round-off.
% ?- A& d9 E# z; G
; U% N# i2 z! P) E k6 n ^ C = conv2(..., SHAPE) returns a subsection of the 2-D
: F5 x/ \, b8 S' X. x3 x+ s4 y convolution with size specified by SHAPE:
" y [# J% a4 }% b% ^ t) c2 @ 'full' - (default) returns the full 2-D convolution,5 L% c0 ^ O, b% }7 u
'same' - returns the central part of the convolution2 \7 R8 K" W$ y/ C" d# N
that is the same size as A.
2 q8 d' g; f- j1 G: |, B! ?/ u 'valid' - returns only those parts of the convolution
1 O, Y m+ \$ \* S that are computed without the zero-padded edges.1 R. G& n! O$ M/ j9 u1 o
size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).9 ]; T; v+ R5 E/ O) y
& \0 m0 A! Q; L- x) d* n
: t3 I& n$ h. f& o* n6 T8 b. m$ I3 E$ Y关于full, same以及valid三种参数的区别,如下面的实例所示:, z% p9 ]5 S: ~* ^6 ~5 k% _
! S( j% O* ^$ b- i; Qfull
8 q: O2 G# u5 ~
$ Y. e: b. w- h% b
# E( s U0 p5 R4 y
) N2 }, n. q7 D; O& Y9 n) t
1 q) u1 f6 f) {7 nsame
& Q9 f2 ~& {% X9 w8 O5 Y# @5 ~# i6 G( v7 S
1 K. u- B4 ~! J& a. m
+ l" D$ o" _0 l0 B) W+ n5 c
9 L- C) O1 j; b/ G1 e! k5 c; \valid
& r6 Z) ~- G8 J, B3 g
$ j( ^; W8 l- Y+ Z0 Z4 Y$ m1 x$ o9 y# Y6 {6 G }
c& K X8 o; ]/ a4 M8 ]+ s0 K
|
|