MATLAB conv2 giving wrong answer as compare to manual with Valid
조회 수: 2 (최근 30일)
이전 댓글 표시
When I use conv2 the 'valid' its gives negative answers.. like
A= 3 0 1 2 7 4
1 5 8 9 3 1
2 7 2 5 1 3
0 1 3 1 7 8
4 2 1 6 2 8
2 4 5 2 3 9
b= 1 0 -1
1 0 -1
1 0 -1
manually conv of A with b =
-5 -4 0 8
-10 -2 2 3
0 -2 -4 -7
-3 -2 - 3 -16
but MATLAB i get
5 4 0 -8
10 2 -2 -3
0 2 4 7
3 2 3 16
i cant understand the reason
댓글 수: 0
채택된 답변
Walter Roberson
2019년 4월 17일
You did not fliplr() the convolution kernel when you calculated by hand. MATLAB uses the convention that the convolution kernel is mirrored; this convention fits with the definition of integral convolution involving integral of f(tau)*g(t-tau) -- notice the implicit time reversal of g
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!