ident/LS_ex.py
changeset 0 0efde00f9229
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ident/LS_ex.py	Fri May 27 14:24:59 2011 +0530
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# 6.1
+
+import scipy as sp
+from pylab import *
+from scipy import linalg
+
+Mag = 10
+V = 10
+No_pts = 100
+theta = 2
+Phi = Mag * (1-2*random([No_pts,1]))
+E = V * (1-2*random([No_pts,1]))
+Z = Phi*theta + E
+LS, res, rank, s = linalg.lstsq(Phi,Z)
+Max = max(Z/Phi)
+Min = min(Z/Phi)
+
+print LS, Max, Min