GNU Radio Manual and C++ API Reference  3.8.1.0
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  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H
24 #define INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H
25 
26 #include <gnuradio/analog/api.h>
27 #include <gnuradio/sync_block.h>
28 
29 namespace gr {
30 namespace analog {
31 
32 /*!
33  * \brief quadrature demodulator: complex in, float out
34  * \ingroup modulators_blk
35  *
36  * \details
37  * This can be used to demod FM, FSK, GMSK, etc. The input is complex
38  * baseband, output is the signal frequency in relation to the sample
39  * rate, multiplied with the gain.
40  *
41  * Mathematically, this block calculates the product of the one-sample
42  * delayed input and the conjugate undelayed signal, and then calculates
43  * the argument of the resulting complex number:
44  *
45  * \f$y[n] = \mathrm{arg}\left(x[n] \, \bar x [n-1]\right)\f$.
46  *
47  * Let \f$x\f$ be a complex sinusoid with amplitude \f$A>0\f$, (absolute)
48  * frequency \f$f\in\mathbb R\f$ and phase \f$\phi_0\in[0;2\pi]\f$ sampled at
49  * \f$f_s>0\f$ so, without loss of generality,
50  *
51  * \f$x[n]= A e^{j2\pi( \frac f{f_s} n + \phi_0)}\f$
52  *
53  * then
54  *
55  * \f{align*}{ y[n] &= \mathrm{arg}\left(A e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)}
56  * \overline{A e^{j2\pi( \frac f{f_s} (n-1) + \phi_0)}}\right)\\
57  * & = \mathrm{arg}\left(A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0\right)} e^{-j2\pi(
58  * \frac f{f_s} (n-1) + \phi_0)}\right)\\
59  * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n + \phi_0 - \frac f{f_s} (n-1)
60  * - \phi_0\right)}\right)\\
61  * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s} n - \frac f{f_s}
62  * (n-1)\right)}\right)\\
63  * & = \mathrm{arg}\left( A^2 e^{j2\pi\left( \frac f{f_s}
64  * \left(n-(n-1)\right)\right)}\right)\\
65  * & = \mathrm{arg}\left( A^2 e^{j2\pi \frac f{f_s}}\right) \intertext{$A$ is real, so is
66  * $A^2$ and hence only \textit{scales}, therefore $\mathrm{arg}(\cdot)$ is invariant:} &=
67  * \mathrm{arg}\left(e^{j2\pi \frac f{f_s}}\right)\\
68  * &= \frac f{f_s}\\
69  * &&\blacksquare
70  * \f}
71  */
73 {
74 public:
75  // gr::analog::quadrature_demod_cf::sptr
76  typedef boost::shared_ptr<quadrature_demod_cf> sptr;
77 
78  /* \brief Make a quadrature demodulator block.
79  *
80  * \param gain Gain setting to adjust the output amplitude. Set
81  * based on converting the phase difference between
82  * samples to a nominal output value.
83  */
84  static sptr make(float gain);
85 
86  virtual void set_gain(float gain) = 0;
87  virtual float gain() const = 0;
88 };
89 
90 } /* namespace analog */
91 } /* namespace gr */
92 
93 #endif /* INCLUDED_ANALOG_QUADRATURE_DEMOD_CF_H */
boost::shared_ptr< quadrature_demod_cf > sptr
Definition: quadrature_demod_cf.h:76
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition: basic_block.h:43
synchronous 1:1 input to output with historyOverride work to provide the signal processing implementa...
Definition: sync_block.h:37
#define ANALOG_API
Definition: gr-analog/include/gnuradio/analog/api.h:30
quadrature demodulator: complex in, float out
Definition: quadrature_demod_cf.h:72