author | Puneeth Chaganti <punchagan@fossee.in> |
Fri, 27 May 2011 14:24:59 +0530 | |
changeset 0 | 0efde00f9229 |
permissions | -rw-r--r-- |
#!/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