|
|
EDA365欢迎您登录!
您需要 登录 才可以下载或查看,没有帐号?注册
x
! j0 @. c$ v2 w& z9 Q: |
9 z$ {3 Y% W# A K Z$ k# wmatlab中的conv2是用于对二维数据进行卷积运算,有三个参数可供选择,下面是help content of conv2
- e4 E9 v, _: ?$ I' M
% Q' q. P, B+ ?conv2 Two dimensional convolution.0 a* s# _* k) k" J9 \8 y
! q) R L$ P' @5 h) T+ k C = conv2(A, B) peRForms the 2-D convolution of matrices A and B.
- f- c: s" M% r If [ma,na] = size(A), [mb,nb] = size(B), and [mc,nc] = size(C), then# r+ A: h6 m/ s+ O' `
mc = max([ma+mb-1,ma,mb]) and nc = max([na+nb-1,na,nb]).
9 o; Q9 u" _: @) u2 q$ a8 \
! M' u9 z- F' a' m C = conv2(H1, H2, A) first convolves each column of A with the vector5 C, I& m5 a+ Q; h, A7 r; ^ Y
H1 and then convolves each row of the result with the vector H2. If' g' l2 _" f8 V) p" Z- K
n1 = length(H1), n2 = length(H2), and [mc,nc] = size(C) then
% M- W7 _- P- t/ D mc = max([ma+n1-1,ma,n1]) and nc = max([na+n2-1,na,n2]).
. x9 ^7 O8 ?% f0 O" ~ conv2(H1, H2, A) is equivalent to conv2(H1(:)*H2(:).', A) up to
3 P! \' |5 m9 E5 Y( m8 e round-off.; d% S0 f- d2 ~1 w
8 K% x* M; A c \ C = conv2(..., SHAPE) returns a subsection of the 2-D
# z" ]2 B; A6 f, G x) E! J- G% Y convolution with size specified by SHAPE:8 G8 x* [) p8 R% \) B
'full' - (default) returns the full 2-D convolution,
) a& O# _' k5 K 'same' - returns the central part of the convolution6 s! s v I3 V x. d y
that is the same size as A.2 \* ?6 b3 K3 e
'valid' - returns only those parts of the convolution
- @. \6 \! J0 F" _) [ B6 |- y7 f that are computed without the zero-padded edges." Y& A, F. P1 H) A3 b: V6 ^
size(C) = max([ma-max(0,mb-1),na-max(0,nb-1)],0).
r% m$ g1 j, W* l5 m& z4 ?# ?- i7 }9 ?4 S% G2 Z/ v0 k0 @; X
; @( `8 L4 c/ q0 ^0 w. S关于full, same以及valid三种参数的区别,如下面的实例所示:' l. i( F% g+ V5 o" M! ]
" W J/ z2 N' E2 m. A% b: N
full- x* a c( @; }0 k
5 F' p+ P [/ k) h/ h. I) i
8 m& i( w! Y8 j# w% G" u. E" ^, D% s. f$ {2 ?9 W- i5 \% N
s" k: ?; |8 [1 \/ Q; d
same: C6 m+ a% K2 |& I; Z
" Q2 q+ q, ^# ?( ]
4 ^- y6 J5 x. G, x
$ W% _; K0 m, j: i5 ], p- C0 C8 C
4 C( `6 l, K( U2 c( o- D: W( ovalid# H$ K* w1 S: z4 ^. X# n' Y
8 `: w' i- U7 y% @0 o; L5 m3 k s8 V, h; g
, {; K+ P4 u8 G" u
/ C; k: P9 k- A( c4 U2 @& Z
|
|