lstsq/quickref.tex
author Anoop Jacob Thomas<anoop@fossee.in>
Sun, 07 Nov 2010 18:36:59 +0530
changeset 398 36295bb91766
parent 330 efb8ddf26aff
permissions -rw-r--r--
Added quickrefs for dictionaries, getting started with arrays, for, matrices, other plots, savefig, using python modules.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
330
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
     1
Creating a matrix with all ones:\\
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
     2
{\ex \lstinline|    o = ones_like(l)|}
237
6c203780bfbe Converted lstsq to new template form
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     3
330
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
     4
Creating the A matrix:\\
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
     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
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
     7
Computing least square:\\
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
     8
{\ex \lstinline|    result = lstsq(A, tsq)|}
237
6c203780bfbe Converted lstsq to new template form
Nishanth <nishanth@fossee.in>
parents:
diff changeset
     9
330
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
    10
Obtaining the m and c values:\\
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
    11
{\ex \lstinline|    m, c = result[0]|}
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
    12
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
    13
Computing the least square fit line:\\
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
    14
{\ex \lstinline|    lst_line = m * l + c|}
efb8ddf26aff Finished lstsq
Nishanth <nishanth@fossee.in>
parents: 237
diff changeset
    15