discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Discuss-gnuradio] Frequency discriminator using a frequency to volt


From: Marcus Müller
Subject: Re: [Discuss-gnuradio] Frequency discriminator using a frequency to voltage converter
Date: Thu, 5 Nov 2015 12:54:18 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0

Hi Larry,

please answer to the list, and not to the individual people, if possible :)

The quadrature demod gives you the "instantaneous" frequency between consecutive samples. Mathematically, it's conjugate multiplication of the samples with a single-sample delayed version of themselves, followed by calculation of the argument of that complex number:

quadrature demod: input signal x, output y. Notice you're doing digital signal processing, and hence, it's not $x(t),\,
      r\in\mathbb R$, but $x[n],\, n\in
      \mathbb N_0$.

$y[n] =
      \mathrm{arg}\left(x[n] \, \bar x [n-1]\right)$.

To answer your question what quadrature demod is like, there's no way around doing a little bit of math. Don't worry, it'll be fun (at least I had fun writing this down):


Imagine $x$ is a complex oscillation with amplitude $A>0$, (absolute) frequency $f\in\mathbb R$ and phase $\phi_0\in[0;2\pi]$ sampled at $f_s>0$ so, without loss of generality,
$x[n]= A
      e^{j2\pi( \frac f{f_s} n + \phi_0)}$

then
\documentclass{article}
      \usepackage[utf8x]{inputenc}
      \usepackage{amsmath}
      \usepackage{amsfonts}
      \usepackage{amssymb}
      \usepackage{trfsigns}
      \DeclareMathOperator*{\argmin}{arg\,min}
      \usepackage{tikz}
      \usepackage{circuitikz}
      \usepackage[binary-units=true]{siunitx}
      \sisetup{exponent-product = \cdot}
      \DeclareSIUnit{\dBm}{dBm}
      \newcommand{\imp}{\SI{50}{\ohm}}
      \newcommand{\wrongimp}{\SI{75}{\ohm}}
      \pagestyle{empty}
      \begin{document}
      \begin{align*}
      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}\\
      &&\blacksquare
      \end{align*}%
      \end{document}


So, your quadrature demod gives you one sample output of relative frequency per input sample, and hence is neither, but it's pretty close to the "frequency to voltage" converter, if you low-pass filter and decimate the output of quadrature demod.


Cheers,
Marcus
On 05.11.2015 11:39, larry ho wrote:
Thank you very much Marcus

The quadrate demodulator did achieve what i wanted. Your advice on Qt frequency sink is really interesting, I'll look into it. Regarding quadrate modulation block, does it take on the same principle as the Qt frequency sink "takes in a period of signal, and shows you all the frequencies' magnitudes it can detect at once. It's "one signal over a lot of time in, a set of a lot of frequency magnitudes out""?

Regards

Larry


To: address@hidden
From: address@hidden
Date: Thu, 5 Nov 2015 10:22:04 +0100
Subject: Re: [Discuss-gnuradio] Frequency discriminator using a frequency to voltage converter

Hi Larry,
in addition to what Kim said:
You'll have to consider that what the Qt frequency sink and what a frequency to voltage converter does are pretty different things:
  • The freq-to-volt converter takes a signal and (ideally) gives you a reading determining the (somehow defined) strongest frequency in your signal. So it's "one signal over a lot of time in, one number out", if you want so.
  • The Qt frequency sink takes in a period of signal, and shows you all the frequencies' magnitudes it can detect at once. It's "one signal over a lot of time in, a set of a lot of frequency magnitudes out".
So the core question is: What do you really want to do, mathematically?

Because I find that highly cool, here's what's happening inside the Qt frequency sink, even if that might be unrelated to your problem:
  • takes in a vector of N samples
  • Computes a discrete Fourier transform (using FFTw's fast fourier transform algorithms) of length N
  • computes the square of the magnitude, the logarithm of that, normalizes each of the N complex result values
  • optionally: averages each bin individually
  • regularly updates the plot with the N-vector of PSD

Best regards,
Marcus


On 04.11.2015 13:15, larry ho wrote:

Hi 


I am new to linux and GNU Radio, I am trying to create a frequency to voltage converter, I tried looking into the source code of QT GUI Frequency Sink to get an idea how it detects frequency. However, it seems a little complicated, is there any particular function i should look out for in the coding? Or are there any alternative in creating a frequency to voltage converter. Greatly appreciative if any advise can be provided. Thank you.


Regards


Larry



_______________________________________________
Discuss-gnuradio mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


_______________________________________________ Discuss-gnuradio mailing list address@hidden https://lists.gnu.org/mailman/listinfo/discuss-gnuradio


reply via email to

[Prev in Thread] Current Thread [Next in Thread]