impz

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

impz

willwoods

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.

Will
_______________________________________________
SciPy-user mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: impz

Travis Oliphant-5
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


_______________________________________________
SciPy-user mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/scipy-user