[SciPy-user] impz

Travis E. Oliphant oliphant@enthought....
Wed Apr 16 09:21:58 CDT 2008


Will Woods wrote:
> Hi,
>
> Is there a direct equivalent of matlab's impz() function in scipy?
> In matlab I can do:
>
> [b,a] = butter(4,[1.5/678,15.0/678],'bandpass');
> [h,t] = impz(b,a);
> plot(t,h)
>
> The scipy.signal.impulse function is the closest I can find, but
>
> b,a = scipy.signal.butter(4,[1.5/678,15.0/678],'bandpass')
> T,h = scipy.signal.impulse((b,a))
> plot(T,h)
>
> doesn't give the same answer.
>   

Right, the latter gives samples of the continuous-time impulse 
response.  You are looking for the discrete-time impulse response.     
The function is not directly available.   However, you can get it (minus 
the auto-compute N part), using

N = 100
x = scipy.zeros(N)
x[0] = 1
h = scipy.signal.lfilter(b,a, x)

-Travis




More information about the SciPy-user mailing list