diff -r 978d06520462 -r f978ddc90960 day1/session3.tex --- a/day1/session3.tex Wed Nov 04 10:35:53 2009 +0530 +++ b/day1/session3.tex Wed Nov 04 22:08:13 2009 +0530 @@ -527,116 +527,4 @@ \end{lstlisting} \end{frame} -\begin{frame}[fragile] -\frametitle{Least Squares Fit} -\vspace{-0.15in} -\begin{figure} -\includegraphics[width=4in]{data/L-Tsq-Line.png} -\end{figure} -\end{frame} - -\begin{frame}[fragile] -\frametitle{Least Squares Fit} -\vspace{-0.15in} -\begin{figure} -\includegraphics[width=4in]{data/L-Tsq-points.png} -\end{figure} -\end{frame} - -\begin{frame}[fragile] -\frametitle{Least Squares Fit} -\vspace{-0.15in} -\begin{figure} -\includegraphics[width=4in]{data/least-sq-fit.png} -\end{figure} -\end{frame} - -\begin{frame} -\frametitle{Least Square Fit Curve} -\begin{itemize} -\item $T^2$ and $L$ have a linear relationship -\item Hence, Least Square Fit Curve is a line -\item we shall use the \typ{lstsq} function -\end{itemize} -\end{frame} - -\begin{frame}[fragile] -\frametitle{\typ{lstsq}} -\begin{itemize} -\item We need to fit a line through points for the equation $T^2 = m \cdot L+c$ -\item The equation can be re-written as $T^2 = A \cdot p$ -\item where A is - $\begin{bmatrix} - L_1 & 1 \\ - L_2 & 1 \\ - \vdots & \vdots\\ - L_N & 1 \\ - \end{bmatrix}$ - and p is - $\begin{bmatrix} - m\\ - c\\ - \end{bmatrix}$ -\item We need to find $p$ to plot the line -\end{itemize} -\end{frame} - -%%making vander without vander, simple matrix -\subsection{Van der Monde matrix generation} -\begin{frame}[fragile] -\frametitle{Van der Monde Matrix} -\begin{itemize} -\item A is also called a Van der Monde matrix -\item It can be generated using \typ{vander} -\end{itemize} -\begin{lstlisting} -In []: A = vander(L, 2) -\end{lstlisting} -Gives the required Van der Monde matrix -\begin{equation*} - \begin{bmatrix} - l_1 & 1 \\ - l_2 & 1 \\ - \vdots & \vdots\\ - l_N & 1 \\ - \end{bmatrix} -\end{equation*} - -\end{frame} - -\begin{frame}[fragile] -\frametitle{\typ{lstsq} \ldots} -\begin{itemize} -\item Now use the \typ{lstsq} function -\item Along with a lot of things, it returns the least squares solution -\end{itemize} -\begin{lstlisting} -In []: coef, res, r, s = lstsq(A,TSq) -\end{lstlisting} -\end{frame} - -\subsection{Plotting} -\begin{frame}[fragile] -\frametitle{Least Square Fit Line \ldots} -We get the points of the line from \typ{coef} -\begin{lstlisting} -In []: Tline = coef[0]*L + coef[1] -\end{lstlisting} -\begin{itemize} -\item Now plot Tline vs. L, to get the Least squares fit line. -\end{itemize} -\begin{lstlisting} -In []: plot(L, Tline) -\end{lstlisting} -\end{frame} - -\begin{frame}[fragile] - \frametitle{What did we learn?} - \begin{itemize} - \item Least square fit - \item Van der Monde matrix generation - \item Plotting the least square fit curve - \end{itemize} -\end{frame} - \end{document}