Velocity Reviews > Convolution of different sized arrays

# Convolution of different sized arrays

Olenka Subota
Guest
Posts: n/a

 07-26-2011
Hello all,

I need your help. I have to simulate a filter whose transfer function
is a step fct, and I wrote it as a column-vector of Ns elements :
>>> h=ones(3,dtype=float)
>>> print h

[ 1. 1. 1.]
>>> h=reshape(h,(3,1))
>>> h

array([[ 1.],
[ 1.],
[ 1.]])

In this case Ns=3 for simplicity.
The input of my filter is another column-vector of k*Ns elements
(3*3):
x0_vect
array([[ 1.41421356],
[ 0. ],
[ 0. ],
[ 1.41421356],
[ 0. ],
[ 0. ],
[ 1.41421356],
[ 0. ],
[ 0. ]])
So I`d like to convolve the two column vectors. Am I going to obtain a
row-vector?
I`ve tried to apply the convolve built-in function but it gives me
this error:
convolve(x0_vect,h)

Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
convolve(x0_vect,h)
File "C:\Python27\lib\site-packages\numpy\core\numeric.py", line
787, in convolve
return multiarray.correlate(a, v[::-1], mode)
ValueError: object too deep for desired array

If anyone of you can help, please do it..
Thanks!

Billy Mays
Guest
Posts: n/a

 07-26-2011
On 07/26/2011 08:10 AM, Olenka Subota wrote:
> If anyone of you can help, please do it..
> Thanks!

You would probably get a better answer asking on one of the mailing
lists here: http://new.scipy.org/mailing-lists.html