[SciPy-user] butterworth filter

cyril giraudon cyril.giraudon@free...
Tue Sep 9 08:37:26 CDT 2008


Hi,

I use scipy 0.6.0 and i try to reproduce the plot of the matlab butter 
function web documentation (first response for a google request "matlab 
butter example").

The matlab code is :

[z,p,k] = butter(9,300/500,'high');
[sos,g] = zp2sos(z,p,k);	     % Convert to SOS form
Hd = dfilt.df2tsos(sos,g);   % Create a dfilt object
h = fvtool(Hd);	             % Plot magnitude response
set(h,'Analysis','freq')	     % Display frequency response 


In scipy, I write :

from scipy.signal import butter, freqz

from pylab import show, grid, log, plot

b, a = butter(9, 300./500., 'high')

fi = freqz(b, a)

plot(fi[0], 20*log(abs(fi[1])))

grid()

show()



Why are the two filters not the same ?


Thanks a lot,

Cyril.




More information about the SciPy-user mailing list