author | Amit Sethi |
Wed, 10 Nov 2010 17:25:18 +0530 | |
changeset 443 | 79a7ca3073d4 |
parent 330 | efb8ddf26aff |
permissions | -rw-r--r-- |
330 | 1 |
Creating a matrix with all ones:\\ |
2 |
{\ex \lstinline| o = ones_like(l)|} |
|
237
6c203780bfbe
Converted lstsq to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
3 |
|
330 | 4 |
Creating the A matrix:\\ |
5 |
{\ex \lstinline| A = array(l, ones_like(l)).T|} |
|
237
6c203780bfbe
Converted lstsq to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
6 |
|
330 | 7 |
Computing least square:\\ |
8 |
{\ex \lstinline| result = lstsq(A, tsq)|} |
|
237
6c203780bfbe
Converted lstsq to new template form
Nishanth <nishanth@fossee.in>
parents:
diff
changeset
|
9 |
|
330 | 10 |
Obtaining the m and c values:\\ |
11 |
{\ex \lstinline| m, c = result[0]|} |
|
12 |
||
13 |
Computing the least square fit line:\\ |
|
14 |
{\ex \lstinline| lst_line = m * l + c|} |
|
15 |