Quadrature Demod: Difference between revisions

From GNU Radio
Jump to navigation Jump to search
No edit summary
mNo edit summary
(24 intermediate revisions by one other user not shown)
Line 5: Line 5:


Mathematically, this block calculates the product of the one-sample
Mathematically, this block calculates the product of the one-sample
delayed input and the conjugate undelayed signal, and then calculates
delayed-&-conjugated input and the undelayed signal, and then calculates
the argument of the resulting complex number:
the argument (a.k.a. angle, in radians) of the resulting complex number:


<math>y[n] = \mathrm{arg}\left(x[n] \, \bar x [n-1]\right)</math>
<math>y[n] = \mathrm{arg}\left(x[n] \, \bar x [n-1]\right)</math>


Let x be a complex sinusoid with amplitude A>0, (absolute)
Let x be a complex sinusoid with amplitude A>0, (absolute)
frequency <math>f\in\mathbb R</math> and phase \phi_0\in[0;2\pi] sampled at
frequency <math>f\in\mathbb R</math> and phase <math>\phi_0\in[0;2\pi]</math> sampled at
f_s>0 so, without loss of generality,
f_s>0 so, without loss of generality,


<math>x[n]= A e^{j2\pi( \frac f{f_s} n + \phi_0)}\f</math>
<math>x[n]= A e^{j2\pi( \frac f{f_s} n + \phi_0)} \ f</math>


then
then


y[n] = \mathrm{arg}\left(A e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} \overline{A e^{j2\pi( \frac f{f_s} (n-1) + \phi_0)}}\right)\ = \mathrm{arg}\left(A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} e^{-j2\pi( \frac f{f_s} (n-1) + \phi_0)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0 - \frac f{f_s} (n-1) - \phi_0\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n - \frac f{f_s} (n-1)\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} \left(n-(n-1)\right)\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi \frac f{f_s}}\right) \intertext{$A$ is real, so is $A^2$ and hence only \textit{scales}, therefore $\mathrm{arg}(\cdot)$ is invariant:} = \mathrm{arg}\left(e^{j2\pi \frac f{f_s}}\right)\= \frac f{f_s}\\
<math>y[n] = \mathrm{arg}\left(A e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} \overline{A e^{j2\pi( \frac f{f_s} (n-1) + \phi_0)}}\right)\ = \mathrm{arg}\left(A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} e^{-j2\pi( \frac f{f_s} (n-1) + \phi_0)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0 - \frac f{f_s} (n-1) - \phi_0\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n - \frac f{f_s} (n-1)\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} \left(n-(n-1)\right)\right)}\right)\ = \mathrm{arg}\left( A^2 e^{j2\pi \frac f{f_s}}\right) </math>


A rendered version of the equations is available there: [https://www.gnuradio.org/doc/doxygen/classgr_1_1analog_1_1quadrature__demod__cf.html]
<math>A</math> is real, and so is <math>A^2</math>, and hence only scales, therefore <math>\mathrm{arg}(\cdot)</math> is invariant: = arg <math>\left( e^{j2 \pi \frac{f}{f_s}} \right) = \frac{f}{f_s}</math>


== Parameters ==
== Parameters ==


; Gain
; Gain
: Gain setting to adjust the output amplitude. Set based on converting the phase difference between samples to a nominal output value.
: Gain setting to adjust the output amplitude. Set based on converting the phase difference between samples to a nominal output value. Default: "samp_rate/(2*math.pi*fsk_deviation_hz)".


== Example Flowgraph ==
== Example Flowgraph ==

Revision as of 18:42, 4 December 2020

This can be used to demod FM, FSK, GMSK, etc. The input is complex baseband, output is the signal frequency in relation to the sample rate, multiplied with the gain.

Mathematically, this block calculates the product of the one-sample delayed-&-conjugated input and the undelayed signal, and then calculates the argument (a.k.a. angle, in radians) of the resulting complex number:

Let x be a complex sinusoid with amplitude A>0, (absolute) frequency and phase sampled at f_s>0 so, without loss of generality,

then

is real, and so is , and hence only scales, therefore is invariant: = arg

Parameters

Gain
Gain setting to adjust the output amplitude. Set based on converting the phase difference between samples to a nominal output value. Default: "samp_rate/(2*math.pi*fsk_deviation_hz)".

Example Flowgraph

This flowgraph shows the Quadrature Demod block as a Frequency Shift Keying detector.

RTTY rcv.png

Source Files

C++ files
[1]
Header files
[2]
Public header files
[3]
Block definition
[4]