diff options
author | Jovina | 2011-08-02 12:58:08 +0530 |
---|---|---|
committer | Jovina | 2011-08-02 12:58:08 +0530 |
commit | 4fb4c7f41d00de1d383d0d3f25384cca2a74043f (patch) | |
tree | dd4fcec874d162c7d35415875a0af974fbe53dc8 /least_square_fit/script.rst | |
parent | 4d2ec5b5b96ac3da95d8b7245376e5b6694dfb9e (diff) | |
download | st-scripts-4fb4c7f41d00de1d383d0d3f25384cca2a74043f.tar.gz st-scripts-4fb4c7f41d00de1d383d0d3f25384cca2a74043f.tar.bz2 st-scripts-4fb4c7f41d00de1d383d0d3f25384cca2a74043f.zip |
Minor changes to scripts in 4th module.
Diffstat (limited to 'least_square_fit/script.rst')
-rw-r--r-- | least_square_fit/script.rst | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/least_square_fit/script.rst b/least_square_fit/script.rst index 429b640..acf6432 100644 --- a/least_square_fit/script.rst +++ b/least_square_fit/script.rst @@ -115,6 +115,10 @@ values of m and c. .. L8 {{{ Switch to the terminal }}} +:: + + inter_mat = array((l, ones_like(l))) + inter_mat .. R8 @@ -122,18 +126,12 @@ let us now generate the A matrix with l values. We shall first generate a 2 x 90 matrix with the first row as l values and the second row as ones. Then take the transpose of it. Type -.. L9 -:: - - inter_mat = array((l, ones_like(l))) - inter_mat - .. R9 We see that we have intermediate matrix. Now we need the transpose. Type -.. L10 +.. L9 :: A = inter_mat.T @@ -145,7 +143,7 @@ Now we have both the matrices A and tsq. We only need to use the ``lstsq`` Type -.. L11 +.. L10 :: result = lstsq(A, tsq) @@ -155,7 +153,7 @@ Type The result is a sequence of values. The first item in this sequence, is the matrix p i.e., the values of m and c. -.. L12 +.. L11 :: m, c = result[0] @@ -167,7 +165,7 @@ is the matrix p i.e., the values of m and c. Now that we have m and c, we need to generate the fitted values of t^2. Type -.. L13 +.. L12 :: tsq_fit = m * l + c @@ -178,6 +176,8 @@ Type We get the least square fit of l vs t^2. +.. L13 + .. L14 {{{ Show summary slide }}} |