# [SciPy-user] Convolve an input with a seri of impulses

Mickael mickael.paris@gmail....
Tue Apr 21 07:01:40 CDT 2009

```Hi Ivo,
My LTI system is just characterised by the "num" and "den" arrays. What I'm
trying to do is to shape my input signal which will apply to H(nem,dem) in
order to control the vibration. Convolving a step entry (for exemple) with
some impulses allows to decrease the natural vibration of H, this method is
known as "Input-shaping". Since this morning I'm working on your code
"conv2.py" and I've seen that you convolve Hout with x (the sequence of two
impulses). In fact, this the step "u" that must be convolved with "x":

x = kron(my_seq, pulse_vec)
#y = convolve(Hout,x)
y = signal.fftconvolve(u,x) --->fftconvolve allows to obtain the good shaped
command (the step command is transformed to a staircase command)

The result is a staircase where the number of stair is equal to the number
of impulse.  Just before to post the results, I' m looking if the ouput
times are correct (as you explain)
Again, thanks for your help, it seems to work ;)
Mickael.

2009/4/21 Ivo Maljevic <ivo.maljevic@gmail.com>

> Mickael,
> I do not know why you have to characterise your LTI system in a such way. I
> would probably
> find an impulse response of the system characterised with num and den using
> filter() and than
> I would have full control. I am only guessing that you are trying to
> describe an analog system,
> and this is probably a convenient way, but one I never use. See if the time
> output has a different
> sampling rate (tout variable) than the time axis I've added. In this case
> you would have to use tout
> and set your pulse sequence to zeros at the appropriate points.
>
> All I'm saying is that you have more work to do there.
>
> Ivo
>
> 2009/4/21 Mickael <mickael.paris@gmail.com>
>
>
>>
>> 2009/4/20 Ivo Maljevic <ivo.maljevic@gmail.com>
>>
>> I never use LTI systems defined in this way, but out of curiosity I tried
>>> to make some changes into my original code in a hope I will learn something
>>>
>>> Try the attached script, it uses your code.
>>>
>>> Ivo
>>>
>>> 2009/4/20 Mickael <mickael.paris@gmail.com>
>>>
>>>> Hi,
>>>>
>>>>
>>>> I'm trying to convolve a reference signal, like a step signal, with a
>>>> sequence of impulses.  Impulses have different amplitudes and timing :
>>>>
>>>>
>>>> ----------------------------------------------------------------------------
>>>> zeta = 0.0193
>>>> wn = 35037.0
>>>> wd = wn*math.sqrt(1.0-zeta**2)
>>>> K = math.exp(((-zeta*pi)/math.sqrt(1.0-zeta**2)))
>>>>
>>>> num = array([9.871])
>>>> den = array([1,1354,1.228*10**9])
>>>> H = signal.lti(num, den)
>>>>
>>>> # Impulses : amplitudes
>>>> A1 = (1.0/(1.0+K))
>>>> A2 = (K/(1.0+K))
>>>> # Impulses : timing
>>>> t1 = 0
>>>> t2 = (pi/wd)
>>>>
>>>> -----------------------------------------------------------------------------
>>>>
>>>> I would like to apply to "H" the result of a step signal convolve with
>>>> these two pulses but I'don't know to define the vector of the impulses.
>>>> --->T,yout,xout = signal.lsim(H, entree, t)  <=== entree =
>>>> scipy.signal.convolve(*A_step*, My_Impulses?, mode='full')
>>>>
>>>> Thanks,
>>>>
>>>> Mickael.****
>>>> _______________________________________________
>>>> SciPy-user mailing list
>>>> SciPy-user@scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>>
>>>>
>>>
>>> _______________________________________________
>>> SciPy-user mailing list
>>> SciPy-user@scipy.org
>>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>>
>>> Hi Ivo,
>>
>> thank you very much for your help.
>>
>> i will try your code today and post the result
>>
>> thanks,
>>
>> Mickael.
>>
>> _______________________________________________
>> SciPy-user mailing list
>> SciPy-user@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20090421/08c4829d/attachment-0001.html
```