[SciPy-User] Incoherent results with signal.impulse
Warren Weckesser
warren.weckesser@enthought....
Sun Nov 22 13:38:29 CST 2009
Cédrick FAURY wrote:
>>> / Hello,
>>>
>> />/
>> />/ I have scipy 0.7.1, python 2.6, and when I do :
>> />/
>> />/ n = scipy.array([1])
>> />/ d = scipy.array([0.01, 0.2, 1.0])
>> />/ T, yout = scipy.signal.impulse((n,d))
>> />/
>> />/ it gives incoherent results for yout.
>> />/
>> />/ And that doesn't occurs with [1.0, 2.0, 1.0] denominator.
>> />/
>> />/ Is it a bug ?
>> />/ I'm doing something wrong ?
>> />/ Is anybody knows a solution ?
>> /
>>
>> scipy.signal.impulse assumes that the state matrix A is diagonalizable,
>> so it does not give a correct result when A is defective. I would call
>> that a bug. :)
>>
>> The attached file contains the function impulse_response() that uses a
>> different method to compute the impulse response. If run as a script,
>> the code at the bottom of the file plots impulse responses computed by
>> impulse_response() and by scipy.signal.impulse() for your example, and
>> for two other values of the leading coefficient of your denominator.
>>
>>
> Thank you very much, it works fine now !
> Actualy, if i'm right, the solution is to use lsim2 ?
>
Yes, it uses lsim2, with the input U all zeros, and with the initial
condition set to the B matrix (plus the optional X0, if given).
Warren
> Cédrick
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
More information about the SciPy-User
mailing list