Skip to content

Commit

Permalink
Wrapping with divs works, but need unescaped $$'s for KaTeX.
Browse files Browse the repository at this point in the history
  • Loading branch information
bemasher committed Aug 18, 2016
1 parent 4e31f28 commit 89d2a9a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/signal.md
Expand Up @@ -22,20 +22,20 @@ The ERT protocol is an on-off keyed manchester-coded signal transmitted at bit-r
The signal is made up of interleaved in-phase and quadrature samples, 8-bits per component. The amplitude of each sample is:

<div>
\$\$\vert z\vert = \sqrt{\Re(z)^2 + \Im(z)^2}\$\$
$$\vert z\vert = \sqrt{\Re(z)^2 + \Im(z)^2}$$
</div>

To meet performance requirements the magnitude computation has two implementations. The first uses a pre-computed lookup table which maps all possible 8-bit values to their floating-point squares. Calculating the magnitude using the lookup table then only involves two lookups, one addition and one square-root.

The second implementation is an approximation known as Alpha-Max plus Beta-Min whose efficiency comes from eliminating the square root operation:

<div>
\$\$
$$
\begin{aligned}
&\alpha = \frac{2\cos\frac{\pi}{8}}{1+cos\frac{\pi}{8}} \qquad \beta = \frac{2\sin\frac{\pi}{8}}{1+cos\frac{\pi}{8}} \\ \\
\vert z\vert \approx \,&\alpha\cdot\max(\Re(z),\Im(z)) + \beta\cdot\min(\Re(z),\Im(z))
\end{aligned}
\$\$
$$
</div>

## Filtering
Expand All @@ -44,30 +44,30 @@ The second implementation is an approximation known as Alpha-Max plus Beta-Min w
Filtering is required for later bit decision. The ideal filter kernel for a square-wave signal is known as a boxcar and is essentially a moving average. Due to the signal being manchester coded the ideal filter is a step function. Manchester coding mixes data with a clock signal to allow for synchronization and clock recovery while decoding as well as reducing any DC offset that would be present due to content of the data. The symbol length [[N]] is determined by the sampling rate [[F_s]] of the receiver and the data rate [[R]] of the signal.

<div>
\$\$N = \frac{F_s}{R}\$\$
$$N = \frac{F_s}{R}$$
</div>

The maximum sample rate without any sample loss is between 2.4 and 2.56 MHz. To simplify decoding we determine the sample rate from integral symbol lengths. From librtlsdr, the sample rate must satisfy one of two conditions:

<div>
\$\$
$$
\begin{aligned}
225\text{kHz} \lt \, &F_s \le 300\text{kHz} \\
900\text{kHz} \lt \, &F_s \le 3.2\text{MHz} \\
\end{aligned}
\$\$
$$
</div>

From this we can determine all of the valid symbol lengths and their corresponding sample rates. More info [here](https://github.com/bemasher/rtlamr/blob/master/help.md). Filtering can be implemented efficiently by computing the cumulative sum of each sample block and calculating the difference between a pair of subtractions:

<div>
\$\$
$$
\begin{aligned}
\mathbf{M}_i &= \sum_{j=i}^{i+N} \mathbf{S}_j - \mathbf{S}_{j+N} \\ \\
&= (\mathbf{C}_{i+N} - \mathbf{C}_i) - (\mathbf{C}_{i+2N} - \mathbf{C}_{i+N}) \\ \\
&= 2\mathbf{C}_{i+N}-\mathbf{C}_{i+2 N}-\mathbf{C}_i
\end{aligned}
\$\$
$$
</div>

Where [[\mathbf{M}]] is the filtered signal, [[\mathbf{S}]] is the sample vector, [[N]] is the symbol length and [[\mathbf{C}]] is the cumulative or prefix sum of the signal.
Expand Down

0 comments on commit 89d2a9a

Please sign in to comment.