\documentclass[amslatex]{article}
%\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{graphicx}
\usepackage[english]{babel}

\begin{document}


\title{\textbf{Digitization of signals and numerical filtering}}
\section{Introduction}
\label{chap:intro}
In old physics experiments the data acquisition was matter of looking and noting on paper, and data reduction was hand made by people particularly suited to make calculations and thus called {\em Computers}.
A typical data acquisition chain in these old times was characterised by the following elements:
\begin{itemize}
\item Sensors: systems that excited by a certain form of energy, representing the physical phenomenon to observe, give in exit a different form of energy (e.g. light into electricity).
\item Transducers: systems that convert (translate) a form of energy into another (e.g. electrical into mechanical);
\item Recorders: systems to translate the acquired signal in a series of numbers or graphs that could be studied in a second moment. They could record continuously or at discrete times and could be also humans with paper and pencils.
\item Computers: Humans that take the recorded data and elaborate them to obtain an aggregate result.
\end{itemize}

When computers started to be electronic devices, the data acquisition chain changed, but the elements remained essentially the same. Recorders and computers became electronic devices, linked to one another and the data that entered into the computing system had to be formatted in a way understandable to computers, i.e. they had to be in {\em digital} form. \par
This new requirement to the data acquisition chain introduced a new element: the {\em Converters}, i.e. electronic devices that convert a continuous-time, continuous-value (Analogic) signal to discrete time, numerical (digital) data; this is the Analog to Digital Converter (ADC). The inverse converter -- the Digital to Analog Converter (DAC) -- is needed to get an electrical signal from a numerical data stream, in order to realise controlled systems that, from the acquired data, derive a signal that is used to take actions (actuate) on the system itself. An axample of a mechanical controlled system is the damping of a pendulum: a capacitive sensor detects the mass motion, the electrical signal is converted in a numerical stream, a computer applies a numerical filter (e.g. simply invert) to the input data stream and sends the computed {\em error} data stream to the DAC that produces an electrical signal sent to an actuator that exerts forces on the mass.\par
 \section{Sampling}
 \label{chap:sampl}
 As said in previous section, analogic signals have the characteristics to be continuous in time and value. The computer takes some time to elaborate input signals and thus cannot follow the signal continuous evolution; it will, instead, sample the signal value at discrete times. This operation is the signal {\em sampling}. Moreover, the computer has a limited resolution given by the number of bits of its word, thus it will not give the actual value of the signal at the time of sampling, but only the nearest value representable with this word. This operation is called {\em Quantization}. The information linked with the sampled and quantized analogic signal is called {\em digital signal}.
\begin{figure}[bt]
 \centering
 \includegraphics[width=\textwidth]{Sampling.eps}   
   \caption{ \label{fig:Sampling} The operation of sampling and quantization: the continuous signal is taken at discrete times and is coded by integer values. This introduces errors.}
\end{figure} 
 The digital signal is affected by errors by the simple digitalization and quantization process. Let's start from the error introduced by the quantization process. \par 
 The transducer range $Y^s$ is the full range the values of the output signal can assume from the minimum $Y_m$ to the maximum $Y_M$, $Y^s=Y_M-Y_m$. Given a computer with a word of N bits, it can represent $2^N$  numbers by this word, thus, each bit will correspond to a value (called Least Significant Bit --  LSB): 
 		$$LSB=\frac{Y^s}{2^N}.$$
 This value, also called quantum, is the minimum difference that can be represented by the digital coding. All the values within a LSB will be coded by a unique digital value $Y_d$, thus the error introduced by the process of quantization to the original signal is one half of the LSB:
 		$$\epsilon_q=\frac{LSB}{2}=\frac {Y^s}{2^{N+1}}.$$
\subsection{Spectral behaviour of sampled signals}
Let's denote the continuous signals as function of the continuous time $f(t)$ while the sampled signal as a function of the discrete time reperesented by the sample number n $F(n)$. Let's begin to examine the differnces between the continuous and the discrete version of the complex exponential function. For the continuous $f(t)=e^{i\omega t}$ the larger is $\omega$ the larger is rate of oscillations and is periodic for any value of $\omega$. The discrete counterpart has a different behaviour, infact let's consider the complex exponential with frequency $(\Omega_0 + 2 \pi)$:
\begin{equation}
F(n)=e^{i(\Omega_0+2\pi)n}=e^{i\Omega_0 n}e^{2i\pi n} = e^{i\Omega_0 n}.
\label{eq:compl_freq}
\end{equation}
As we see it has the {\em same} frequency as the function with frequency $\Omega_0$, as is for signals with frequency $(\Omega \pm 2\pi)$, $(\Omega \pm 4\pi)$...Therefore in considering discrete time complex exponentials we need to consider only an interval of length $2\pi$.\par 
As far as the periodicity is concerned, in order for the signal to be periodic of period N, it must satisfy the relation:
\begin{equation}
 F(n)=F(n+N) \Rightarrow e^{i\Omega n}=e^{i\Omega(n+N)}
 \label{eq:compl_period}
 \end{equation}
or equivalently: $e^{i\Omega N}=1$, that is $\Omega N = 2k\pi$ i.e. $e^{i\Omega n}$ is not periodic for any $\Omega$, but only for $\Omega = 2 \pi k/N$.\par
The discrete-time sequence obtained by sampling a continuous complex exponential signal at equally spaced points in time is: 
$$ X[n]= e^{i\omega n T}$$
that is a discrete time exponential of period $\omega T$, being T the interval between the samples, i.e. the reciprocal of the sampling pulsation: thus, if $\omega_s=2\pi/T$ is the sampling frequency, the function will be periodical only if $\omega/\omega_s$ is a rational number.\par
\begin{figure}[!ht]
 \centering
 \includegraphics[width=\textwidth]{Nyquist.eps}   
   \caption{ \label{fig:Nyquist} The effect in frequency domain of sampling in time domain. The Fourier transform of the signal to sample has a maximum frequency $\omega_M$, if the sampling frequency $\omega_s >2\omega_M$ the replicas do not overlap}
\end{figure}
Any continuous signal x(t), sampled with a period T can be represented in terms of a sum:
\begin{equation}
x_p(t)= \sum_{n=-\infty}^{n=\infty} x(nT)\delta(t-nT)
\label{eq:time_domain}
\end{equation}
By Fourier transforming this expression, we see that it is the convolution:
\begin{equation}
X_p(\omega) = \frac{1}{2\pi} [X(\omega) * P(\omega)]
\label{eq:convolution}
\end{equation}
where 
\begin{equation}
P(\omega) =\frac{2\pi}{T}  \sum_{k=-\infty}^{k=\infty} \delta(\omega -k\omega_s)
\label{eq:pulse}
\end{equation}
so
\begin{equation}
X_p(\omega)=\frac{1}{T}\sum_{k=-\infty}^{k=\infty} X(\omega -k\omega_s)
\label{eq:spectrum}
\end{equation}
That is $X_p(\omega)$ is a sum of replicas of $X(\omega)$ scaled of 1/T (see Fig\ref{fig:Nyquist}).

If the spectrum of the original signal has a maximun frequency $\omega_M$, then if $\omega_M<(\omega_s-\omega_m)$ i.e. $\omega_s>2\omega_M$ there is no overlap of the replicas and the signal can be recovered exactly from the sampled signal by applying a low-pass filter with cut frequency $\omega_M<\omega_c<(\omega_s -\omega_M)$.  This is what is called {\em the sampling theorem}, the frequency $\omega_s=2\omega_M$ is called the {\em Nyquist frequency}.\par 
The samping theorem can me enunciated as follows:\\
Given a band-limited signal x(t) with $X(\omega)=0$ for each $|\omega|>\omega_M$, then x(t) is uniquelly determined by its samples $x_p(nT)$ if 
$$ \omega_s >2\omega_M$$
where $$\omega_s=2\pi/T$$ is the sampling frequency.


\subsection{The effect of undersampling: Aliasing}
 As was illustrated in Fig. \ref{fig:Nyquist}, with $\omega > 2\omega_{M}$, the spectrum of the sampled signal consists of exact replications of the spectrum of x(t), and this forms the basis for the
sampling theorem. When $\omega < 2\omega_{M}$,  $X(\omega)$, the spectrum of x(t), is no longer replicated
in $X_p(\omega)$ and thus is no longer recoverable by lowpass filtering. This effect, in
which the individual terms in the sum \ref{eq:spectrum} overlap, is referred to as {\em aliasing}, and in this section we explore its effect and consequences.\par
\begin{figure}[!ht]
 \centering
 \includegraphics[width=\textwidth]{Alias1.eps}   
   \caption{ \label{fig:Alias1} The effect of sampling a sinusoidal function at a frequency lower than the Nyquist frequency.}
\end{figure}
Let us consider the simple case of a sinusoidal signal:
$$x(t)=cos(\omega_0 t)$$
Its spectrum will consist of only two lines at $\pm \omega_0$. The spectrum of the signal sampled at frequency $\omega_s < 2\omega_0$ is shown in Fig. \ref{fig:Alias1}, in the cases of $\omega_0=4/6 \omega_s$ and $\omega_0=5/6 \omega_s$, the low-pass filter band is also indicated. In the two cases, the output of the filter is: 
$$ \omega_s \Rightarrow x_f(t)=cos(\omega_s -\omega_0)\neq x(t)$$
The effect of aliasing in the time frequency is shown in Fig. \ref{fig:Alias2}
\begin{figure}[!ht]
 \centering
 \includegraphics[width=\textwidth]{Alias2.eps}   
   \caption{ \label{fig:Alias2} The effect of sampling a sinusoidal function at a frequency lower than the Nyquist frequency in the time domain.}
\end{figure}



 \subsection{Need of signal amplification}
 Another element of the modern data acquisition chain are signal amplifiers
 	
 		
 		
 		
 
\end{document}