MATLAB conv2 giving wrong answer as compare to manual with Valid

11 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Walter Roberson
Walter Roberson el 17 de Abr. de 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

Más respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by