MATLAB conv2 giving wrong answer as compare to manual with Valid

9 vues (au cours des 30 derniers jours)
Raza
Raza le 17 Avr 2019
Commenté : Raza le 17 Avr 2019
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

Réponse acceptée

Walter Roberson
Walter Roberson le 17 Avr 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

Plus de réponses (0)

Catégories

En savoir plus sur Get Started with MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by