lstsq/quickref.tex
changeset 522 d33698326409
parent 521 88a01948450d
child 523 54bdda4aefa5
equal deleted inserted replaced
521:88a01948450d 522:d33698326409
     1 Creating a matrix with all ones:\\
       
     2 {\ex \lstinline|    o = ones_like(l)|}
       
     3 
       
     4 Creating the A matrix:\\
       
     5 {\ex \lstinline|    A = array(l, ones_like(l)).T|}
       
     6 
       
     7 Computing least square:\\
       
     8 {\ex \lstinline|    result = lstsq(A, tsq)|}
       
     9 
       
    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