author | Puneeth Chaganti <punchagan@fossee.in> |
Fri, 27 May 2011 14:24:59 +0530 | |
changeset 0 | 0efde00f9229 |
permissions | -rw-r--r-- |
0 | 1 |
#!/usr/bin/python |
2 |
# 6.1 |
|
3 |
||
4 |
import scipy as sp |
|
5 |
from pylab import * |
|
6 |
from scipy import linalg |
|
7 |
||
8 |
Mag = 10 |
|
9 |
V = 10 |
|
10 |
No_pts = 100 |
|
11 |
theta = 2 |
|
12 |
Phi = Mag * (1-2*random([No_pts,1])) |
|
13 |
E = V * (1-2*random([No_pts,1])) |
|
14 |
Z = Phi*theta + E |
|
15 |
LS, res, rank, s = linalg.lstsq(Phi,Z) |
|
16 |
Max = max(Z/Phi) |
|
17 |
Min = min(Z/Phi) |
|
18 |
||
19 |
print LS, Max, Min |