lstsq/quickref.tex
author Puneeth Chaganti <punchagan@fossee.in>
Tue, 09 Nov 2010 15:33:47 +0530
changeset 413 da1f270b07b7
parent 330 efb8ddf26aff
permissions -rw-r--r--
Change to progress.org
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