Convolution of different sized arrays

Discussion in 'Python' started by Olenka Subota, Jul 26, 2011.

  1. 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!
    Olenka Subota, Jul 26, 2011
    #1
    1. Advertising

  2. Olenka Subota

    Billy Mays Guest

    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
    Billy Mays, Jul 26, 2011
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. thechaosengine

    Oddly sized sized password textbox

    thechaosengine, Sep 15, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    571
    David Hearn
    Sep 15, 2005
  2. Chris Johnson

    Global variable-sized arrays

    Chris Johnson, Nov 23, 2004, in forum: C Programming
    Replies:
    5
    Views:
    383
    Mark A. Odell
    Nov 23, 2004
  3. Replies:
    4
    Views:
    319
    Kai-Uwe Bux
    Dec 13, 2005
  4. CapCity

    Passing Dynaically-Sized Arrays

    CapCity, Jul 10, 2008, in forum: C Programming
    Replies:
    5
    Views:
    267
    CapCity
    Jul 11, 2008
  5. MartinBroadhurst

    List as a dynamic array of increasing-sized arrays

    MartinBroadhurst, Oct 21, 2010, in forum: C Programming
    Replies:
    13
    Views:
    1,053
    MartinBroadhurst
    Nov 3, 2010
Loading...

Share This Page