% -*- latex -*-
% FILE: "/home/evmik/jobs/wm/2012_fall_practical_computing_for_scientists/hw07/hw07.tex"
% LAST MODIFICATION: "Tue, 16 Oct 2012 16:00:24 -0400 (evmik)"
% (C) 2010 by Eugeniy Mikhailov, <evgmik@gmail.com>
% $Id:$
\documentclass[letter,12pt]{article}

%---------------------------------------------------------------
\usepackage{listings}
\usepackage{color}
\usepackage{fullpage}
%---------------------------------------------------------------

\begin{document}
\newcommand{\problem}[1]{%
	{\flushleft  \bf #1\\}
}
\newcommand{\hw}[1]{%
	\begin{center}
		\Large  \bf Homework #1%
	\end{center}%
}
\newcommand{\mat}[1]{% matlab code
{\color{blue}\texttt{#1}}%
}

%---------------------------------------------------------------
\hw{07}

General comments: 
\begin{itemize}
	\item pay attention to error bars
	\item All data files provided at the class web page.
	\item everywhere in this homework use built in \mat{fittype}
		to define fitting function with the following call to \mat{fit}
		for the fitting.
\end{itemize}


\problem{Problem 1 (5 points)}
%---------------------------------------------------------------
Recall one of the problem from the previous homework 2.

Download  data   file  'hw02dataset.dat'  from  the   class  webpage.  It
represents result  of someone attempt  to find  resistance of a  sample via
measuring voltage  drop ($V$),  which is  the data in  the 1st  column, and
current ($I$) listed in the 2nd  column passing through the resistor at the
same  conditions. Judging  by the  number of  samples it  was an  automated
measurement.

Using Ohms law $V=R I$  and linear fit with one free parameter ($R$)
find the resistance ($R$) of this sample. What are the
errorbars/uncertainty of this estimate? Does it come close to the one which
you obtained via method used in homework 2?

\problem{Problem 2 (5 points)}
%---------------------------------------------------------------
You are making speed detector based on the Doppler effect. You device detects
dependence of the signal strength vs time, which recorded in the
'hw\_fit\_cos\_problem.dat' file (first column is time and second is the
signal strength).

Fit the data with 
\begin{eqnarray*}
	A \cos(\omega t +\phi)
\end{eqnarray*}
where $A$,  $\omega$ and $\phi$ are the amplitude, the frequency and the phase of the signal, and $t$ is time.

Find fit parameters: the amplitude, the frequency and the phase of the
signal and their uncertainties. 

\problem{Bonus (2 points)}

Provided that above radar was using radio frequency range, could you estimate
velocity measurement uncertainty. Is it good detector to measure ground car
velocity?


\problem{Problem 3 (5 points)}
%---------------------------------------------------------------
Experiment to do at home. Make a pendulum of variable length (0.1m, 0.2m,
0.3m, and so on up to 1m). Measure how many back and forth swings such
pendulum with a particular length does in 20 second (clearly you will have to round to the nearest
integer).
Save your observations into the simple text file with 'tab' separated
columns. The first column should be the length of the pendulum in meters,
the second column the number of full swings in 20 seconds.

Write a script which loads this data file, and extract acceleration due to
gravity ($g$) from the properly fitted experimental data.
Recall that period of the oscillation of
a pendulum with the length $L$ is given by the following formula
\begin{eqnarray*}
	T = 2 \pi \sqrt{ \frac{L}{g} }
\end{eqnarray*}

\problem{Problem 4 (5 points)}
%---------------------------------------------------------------
In optics propagation of the laser beams are often described in the
Gaussian beams formalism. Among other things, it says that optical beam
intensity cross section is described by Gaussian profile (hence the name of
the formalism)
\begin{eqnarray*}
	I(x) = A \exp{\left( -\frac{(x-x_o)^2}{w^2} \right)} + B
\end{eqnarray*}
where $A$ is the amplitude, $x_o$ is the position of the maximum intensity,
$w$ is the characteristic width of the beam (width at $1/e$ intensity
level), and $B$ is the background illumination of the sensor.

Extract  the  $A$, $x_o$, $w$, and  $B$ with their uncertainties  from the real
experimental data  contained in the file  '{gaussian\_beam.dat}', where the
first column is the position ($x$) in  meters and second column is the beam
intensity in arbitrary units. 

Does the model perfectly describes the experiment? Why so?

\end{document}
