Skip to content

Commit

Permalink
AM demodulation documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
martinber committed Jan 6, 2019
1 parent e3528a9 commit ddcaf40
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 6 deletions.
4 changes: 1 addition & 3 deletions docs/how-it-works.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ samples and filter coefficients.

### AM demodulation

Previously I used a Hilbert filter to get the [analytic signal], then the
Previously I used a Hilbert filter to get the [analytic signal], because the
absolute value of the [analytic signal] is the modulated signal.

Then I found a very fast demodulator implemented on [pietern/apt137]. For each
Expand All @@ -163,8 +163,6 @@ carrier frequency:

![AM demodulation formula]({{ site.baseurl }}/images/demodulation.png)

Where theta is the AM carrier frequency divided by the sample rate.

I couldn't find the theory behind that method, looks similar to I/Q
demodulation. I was able to reach that final expression (which is used by
[pietern/apt137]) by hand and I wrote the steps on ``extra/demodulation.pdf``. I
Expand Down
Binary file modified extra/demodulation.pdf
Binary file not shown.
Binary file modified extra/demodulation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 35 additions & 3 deletions extra/demodulation.tex
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,44 @@
\begin{document}
\pagestyle{empty}

Two samples of an AM signal with carrier frequency $\omega_c$.

\begin{align*}
\begin{cases}
x[0]=A\sin(\omega t_{0}+\alpha)\\
x[1]=A\sin(\omega t_{1}+\alpha)
x[0]=f(t_{0})\sin(\omega_c t_{0}+\alpha)\\
x[1]=f(t_{1})\sin(\omega_c t_{1}+\alpha)
\end{cases}
\end{align*}

If $t_{0}=0$, then $\omega t_{0}=0$ and $\omega t_{1}=\alpha$
If the samples were taken $\Delta t$ seconds apart, then the sampling frequency
$f_s$ is $1/\Delta t$.

\begin{align*}
\begin{cases}
x[0]=f(t_{0})\sin(\omega_c t_{0}+\alpha)\\
x[1]=f(t_{0}+\Delta t)\sin(\omega_c (t_{0}+\Delta t)+\alpha)
\end{cases}
\end{align*}

If $\Delta t$ is quite small, $f(t_0) = f(t_0 + \Delta t) = A$:

\begin{align*}
\begin{cases}
x[0]=A\sin(\omega_c t_{0}+\alpha)\\
x[1]=A\sin(\omega_c (t_{0}+\Delta t)+\alpha)
\end{cases}
\end{align*}

If $t_0 = 0$:

\begin{align*}
\begin{cases}
x[0]=A\sin(\alpha)\\
x[1]=A\sin(\omega_c \Delta t+\alpha)
\end{cases}
\end{align*}

We define $\phi$ as $\omega_c \Delta t = \omega_c / f_s = 2\pi f_c / f_s$.

\begin{align*}
\begin{cases}
Expand Down Expand Up @@ -69,4 +99,6 @@
y[i]=\frac{\sqrt{x[i]^{2}+x[i-1]^{2}-2x[i]x[i-1]\cos\phi}}{\sin\phi}
\end{align*}

Where $\phi = 2\pi f_c / f_s$

\end{document}

0 comments on commit ddcaf40

Please sign in to comment.