MATLAB conv2 giving wrong answer as compare to manual with Valid

8 visualizzazioni (ultimi 30 giorni)
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

Risposta accettata

Walter Roberson
Walter Roberson il 17 Apr 2019
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

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by