lstsq/quickref.tex
author Anoop Jacob Thomas<anoop@fossee.in>
Sun, 07 Nov 2010 16:20:02 +0530
changeset 394 1a79f9ee7f5c
parent 330 efb8ddf26aff
permissions -rw-r--r--
made changes to script, matrices, using array() instead of matrix() now.

Creating a matrix with all ones:\\
{\ex \lstinline|    o = ones_like(l)|}

Creating the A matrix:\\
{\ex \lstinline|    A = array(l, ones_like(l)).T|}

Computing least square:\\
{\ex \lstinline|    result = lstsq(A, tsq)|}

Obtaining the m and c values:\\
{\ex \lstinline|    m, c = result[0]|}

Computing the least square fit line:\\
{\ex \lstinline|    lst_line = m * l + c|}