GNU Radio Manual and C++ API Reference  3.10.9.1
The Free & Open Software Radio Ecosystem
quadrature_demod_cf.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2004,2012 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * SPDX-License-Identifier: GPL-3.0-or-later
8  *
9  */
10 
11 #ifndef INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H
12 #define INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H
13 
14 #include <gnuradio/analog/api.h>
15 #include <gnuradio/sync_block.h>
16 
17 namespace gr {
18 namespace analog {
19 
20 /*!
21  * \brief quadrature demodulator: complex in, float out
22  * \ingroup modulators_blk
23  *
24  * \details
25  * This can be used to demod FM, FSK, GMSK, etc. The input is complex
26  * baseband, output is the signal frequency in relation to the sample
27  * rate, multiplied with the gain.
28  *
29  * Mathematically, this block calculates the product of the one-sample
30  * delayed input and the conjugate undelayed signal, and then calculates
31  * the argument of the resulting complex number:
32  *
33  * \f$y[n] = \mathrm{arg}\left(x[n] \, \bar x [n-1]\right)\f$.
34  *
35  * Let \f$x\f$ be a complex sinusoid with amplitude \f$A>0\f$, (absolute)
36  * frequency \f$f\in\mathbb R\f$ and phase \f$\phi_0\in[0;2\pi]\f$ sampled at
37  * \f$f_s>0\f$ so, without loss of generality,
38  *
39  * \f$x[n]= A e^{j2\pi( \frac f{f_s} n + \phi_0)}\f$
40  *
41  * then
42  *
43  * \f{align*}{ y[n] &= \mathrm{arg}\left(A e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)}
44  * \overline{A e^{j2\pi( \frac f{f_s} (n-1) + \phi_0)}}\right)\\
45  * & = \mathrm{arg}\left(A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} e^{-j2\pi(
46  * \frac f{f_s} (n-1) + \phi_0)}\right)\\
47  * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0 - \frac f{f_s} (n-1)
48  * - \phi_0\right)}\right)\\
49  * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n - \frac f{f_s}
50  * (n-1)\right)}\right)\\
51  * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s}
52  * \left(n-(n-1)\right)\right)}\right)\\
53  * & = \mathrm{arg}\left( A^2 e^{j2\pi \frac f{f_s}}\right) \intertext{$A$ is real, so is
54  * $A^2$ and hence only \textit{scales}, therefore $\mathrm{arg}(\cdot)$ is invariant:} &=
55  * \mathrm{arg}\left(e^{j2\pi \frac f{f_s}}\right)\\
56  * &= \frac f{f_s}\\
57  * &&\blacksquare
58  * \f}
59  */
61 {
62 public:
63  // gr::analog::quadrature_demod_cf::sptr
64  typedef std::shared_ptr<quadrature_demod_cf> sptr;
65 
66  /* \brief Make a quadrature demodulator block.
67  *
68  * \param gain Gain setting to adjust the output amplitude. Set
69  * based on converting the phase difference between
70  * samples to a nominal output value.
71  */
72  static sptr make(float gain);
73 
74  virtual void set_gain(float gain) = 0;
75  virtual float gain() const = 0;
76 };
77 
78 } /* namespace analog */
79 } /* namespace gr */
80 
81 #endif /* INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H */
quadrature demodulator: complex in, float out
Definition: quadrature_demod_cf.h:61
static sptr make(float gain)
virtual void set_gain(float gain)=0
virtual float gain() const =0
std::shared_ptr< quadrature_demod_cf > sptr
Definition: quadrature_demod_cf.h:64
synchronous 1:1 input to output with history
Definition: sync_block.h:26
#define ANALOG_API
Definition: gr-analog/include/gnuradio/analog/api.h:18
GNU Radio logging wrapper.
Definition: basic_block.h:29