ex-6: complete dot product image
This commit is contained in:
parent
b1786aa692
commit
90578f664b
@ -1,6 +1,6 @@
|
|||||||
# Exercise 6
|
# Exercise 6
|
||||||
|
|
||||||
**Generating points according to Fraunhofer diffraction**
|
## Generating points according to Fraunhofer diffraction
|
||||||
|
|
||||||
The diffraction of a plane wave thorough a round slit must be simulated by
|
The diffraction of a plane wave thorough a round slit must be simulated by
|
||||||
generating $N =$ 50'000 points according to the intensity distribution
|
generating $N =$ 50'000 points according to the intensity distribution
|
||||||
@ -50,9 +50,9 @@ where:
|
|||||||
}
|
}
|
||||||
\end{figure}
|
\end{figure}
|
||||||
|
|
||||||
Once again, $\theta$, which must be evenly distributed on half sphere, can be
|
Once again, the *try and catch* method described in @sec:3 was implemented and
|
||||||
generated only as a function of a variable $x$ uniformely distributed between
|
the same procedure about the generation of $\theta$ was employed. This time,
|
||||||
0 and 1. Therefore:
|
though, $\theta$ must be evenly distributed on half sphere:
|
||||||
|
|
||||||
\begin{align*}
|
\begin{align*}
|
||||||
\frac{d^2 P}{d\omega^2} = const = \frac{1}{2 \pi}
|
\frac{d^2 P}{d\omega^2} = const = \frac{1}{2 \pi}
|
||||||
@ -71,7 +71,8 @@ generated only as a function of a variable $x$ uniformely distributed between
|
|||||||
\frac{d\theta}{dx} \right| \right.
|
\frac{d\theta}{dx} \right| \right.
|
||||||
\end{align*}
|
\end{align*}
|
||||||
|
|
||||||
Since $\theta \in [0, \pi/2]$, then the absolute value symbol can be omitted:
|
If $\theta$ is chosen to grew together with $x$, then the absolute value can be
|
||||||
|
omitted:
|
||||||
|
|
||||||
\begin{align*}
|
\begin{align*}
|
||||||
\frac{d\theta}{dx} = \frac{1}{\sin{\theta}}
|
\frac{d\theta}{dx} = \frac{1}{\sin{\theta}}
|
||||||
@ -83,3 +84,90 @@ Since $\theta \in [0, \pi/2]$, then the absolute value symbol can be omitted:
|
|||||||
\\
|
\\
|
||||||
&\thus \theta = \text{acos} (1 -x)
|
&\thus \theta = \text{acos} (1 -x)
|
||||||
\end{align*}
|
\end{align*}
|
||||||
|
|
||||||
|
The sample was stored and plotted in a histogram with a customizable number $n$
|
||||||
|
of bins default set $n = 150$. In \textcolor{red}{fig} an example is shown.
|
||||||
|
|
||||||
|
\textcolor{red}{missing plot.}
|
||||||
|
|
||||||
|
|
||||||
|
## Gaussian noise convolution
|
||||||
|
|
||||||
|
The sample must then be smeared with a gaussian noise with the aim to recover
|
||||||
|
the original sample afterwards, implementing a deconvolution routine.
|
||||||
|
For this purpose, a 'kernel' histogram with a odd number $m$ of bins and the
|
||||||
|
same bin width of the previous one, but a smaller number of them ($m < n$), was
|
||||||
|
filled with $m$ points according to a gaussian distribution with mean $\mu$,
|
||||||
|
corresponding to the central bin, and variance $\sigma$.
|
||||||
|
Then, the original histogram was convolved with the kernel in order to obtain
|
||||||
|
the smeared signal. The procedure is summed up in \textcolor{red}{fig}.
|
||||||
|
|
||||||
|
\textcolor{red}{missing plots.}
|
||||||
|
|
||||||
|
The third histogram was obtained by keeping the same edges of the original
|
||||||
|
signal and a number of bins n +m -1 (?).
|
||||||
|
The convolution was obtained by permorming the dot product between the invere
|
||||||
|
kernel and the clean signal for each relative position of the two histograms.
|
||||||
|
For a better understaing, see \textcolor{red}{fig}.
|
||||||
|
|
||||||
|
\begin{figure}
|
||||||
|
\hypertarget{fig:dot_conv}{%
|
||||||
|
\centering
|
||||||
|
\begin{tikzpicture}
|
||||||
|
\definecolor{cyclamen}{RGB}{146, 24, 43}
|
||||||
|
% original histogram
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (0.0,0) rectangle (0.5,2.5);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (0.5,0) rectangle (1.0,2.8);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (1.0,0) rectangle (1.5,2.3);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (1.5,0) rectangle (2.0,1.8);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (2.0,0) rectangle (2.5,1.4);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (2.5,0) rectangle (3.0,1.0);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (3.0,0) rectangle (3.5,1.0);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (3.5,0) rectangle (4.0,0.6);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (4.0,0) rectangle (4.5,0.4);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (4.5,0) rectangle (5.0,0.2);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (5.0,0) rectangle (5.5,0.2);
|
||||||
|
\draw [thick, cyclamen] (6.0,0) -- (6.0,0.2);
|
||||||
|
\draw [thick, cyclamen] (6.5,0) -- (6.5,0.2);
|
||||||
|
\draw [thick, <->] (0,3.3) -- (0,0) -- (7,0);
|
||||||
|
% kernel histogram
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (1.0,-1) rectangle (1.5,-1.2);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (1.5,-1) rectangle (2.0,-1.4);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (2.0,-1) rectangle (2.5,-1.8);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (2.5,-1) rectangle (3.0,-1.4);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (3.0,-1) rectangle (3.5,-1.2);
|
||||||
|
\draw [thick, <->] (1,-2) -- (1,-1) -- (4,-1);
|
||||||
|
% arrows
|
||||||
|
\draw [thick, <->] (1.25,-0.2) -- (1.25,-0.8);
|
||||||
|
\draw [thick, <->] (1.75,-0.2) -- (1.75,-0.8);
|
||||||
|
\draw [thick, <->] (2.25,-0.2) -- (2.25,-0.8);
|
||||||
|
\draw [thick, <->] (2.75,-0.2) -- (2.75,-0.8);
|
||||||
|
\draw [thick, <->] (3.25,-0.2) -- (3.25,-0.8);
|
||||||
|
\draw [thick, ->] (2.25,-2.0) -- (2.25,-4.2);
|
||||||
|
% smeared histogram
|
||||||
|
\begin{scope}[shift={(0,-1)}]
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (-1.0,-4.5) rectangle (-0.5,-4.3);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] (-0.5,-4.5) rectangle ( 0.0,-4.2);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] ( 0.0,-4.5) rectangle ( 0.5,-2.0);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] ( 0.5,-4.5) rectangle ( 1.0,-1.6);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] ( 1.0,-4.5) rectangle ( 1.5,-2.3);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] ( 1.5,-4.5) rectangle ( 2.0,-2.9);
|
||||||
|
\draw [thick, cyclamen, fill=cyclamen!15!white] ( 2.0,-4.5) rectangle ( 2.5,-3.4);
|
||||||
|
\draw [thick, cyclamen] (3.0,-4.5) -- (3.0,-4.3);
|
||||||
|
\draw [thick, cyclamen] (3.5,-4.5) -- (3.5,-4.3);
|
||||||
|
\draw [thick, cyclamen] (4.0,-4.5) -- (4.0,-4.3);
|
||||||
|
\draw [thick, cyclamen] (4.5,-4.5) -- (4.5,-4.3);
|
||||||
|
\draw [thick, cyclamen] (5.0,-4.5) -- (5.0,-4.3);
|
||||||
|
\draw [thick, cyclamen] (5.5,-4.5) -- (5.5,-4.3);
|
||||||
|
\draw [thick, cyclamen] (6.0,-4.5) -- (6.0,-4.3);
|
||||||
|
\draw [thick, cyclamen] (6.5,-4.5) -- (6.5,-4.3);
|
||||||
|
\draw [thick, cyclamen] (7.0,-4.5) -- (7.0,-4.3);
|
||||||
|
\draw [thick, cyclamen] (7.5,-4.5) -- (7.5,-4.3);
|
||||||
|
\draw [thick, <->] (-1,-2.5) -- (-1,-4.5) -- (8,-4.5);
|
||||||
|
\end{scope}
|
||||||
|
\end{tikzpicture}
|
||||||
|
\caption{Dot product as a step of the convolution between the original signal
|
||||||
|
(above) and the kernel (below). The final result is the lower
|
||||||
|
fledging histogram.}\label{fig:dot_conv}
|
||||||
|
}
|
||||||
|
\end{figure}
|
||||||
|
Loading…
Reference in New Issue
Block a user