freq/filter1.py
changeset 0 0efde00f9229
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/freq/filter1.py	Fri May 27 14:24:59 2011 +0530
@@ -0,0 +1,26 @@
+#!/usr/bin/python
+# 5.2
+
+import scipy as sp
+from pylab import *
+
+omega = linspace(0, pi, 100)
+g1 = 0.5 / (cos(omega)-0.5+1j*sin(omega))
+mag1 = abs(g1)
+angle1 = angle(g1) * 180/pi
+g2 = (0.5+0.5*cos(omega)-1.5*1j*sin(omega)) \
+     * 0.25 / (1.25-cos(omega))
+mag2 = abs(g2)
+angle2 = angle(g2) * 180/pi
+subplot(2,1,1)
+plot(omega,mag1,omega,mag2,'--')
+
+ylabel('Magnitude')
+
+subplot(2,1,2) 
+plot(omega,angle1,omega,angle2,'--')
+xlabel('w (rad/s)')
+ylabel('Phase')
+
+show()
+#axis tight, label('',18,'w (rad/s)','Phase',18)