I am working with a piece of equipment that does acoustic analysis. It does this by acquiring a time domain signal and performing an FFT on it to extract the amplitude and phase at a single desired frequency, call it f0. Now, I understand the FFT. That part is easy enough. However, what I don't understand is the consequences of all the extra steps I found in this instrument's LabView code. Here's the procedure:

  1. Acquire time domain signal and apply calibration coefficient to every point.
  2. Subtract mean from signal to remove DC component
  3. Mix with a pure tone at f0 by multiplying the complex time domain signal with cos(2πf0) - i sin(2πf0)
  4. Window using exact Blackman
  5. Perform FFT
  6. Take DC component of output, divide by N/2 (where N is the number of samples in the time domain)
  7. Get amplitude and phase at f0 from DC component

Specifically, I'm confused on how step 3 allows me to get the value at f0 by looking at the DC component of the FFT output. I've recreated this in python using numpy.fft.fft and some simulated signals and I get similar results.

At the end of the day, I guess this sounds like a theory/math question.

  • $\begingroup$ For every how, there is typically a “why”. Can’t fully explain how without knowing why. $\endgroup$
    – user28715
    Commented Oct 21, 2019 at 23:02

5 Answers 5


What's going on is a variant of I/Q demodulation, done in batch mode using the FFT.

First, the fast Fourier transform is just an algorithm that realizes the discrete Fourier transform quickly; so it's a perfect subset of the DFT. What you're doing applies to the DFT as a whole.

(Now I get all math-y. Or maths-y, if I want to emigrate to some place they speak British).

Second, the DFT is defined as $$X_k = \sum_{n=0}^{N-1} {x_n e^{j 2\pi\frac{k n}{N}}}$$

So if I define a modulated signal as $y_n = x_n e^{j 2 \pi \frac{k_0}{N}n}$ for some integer $k_0$, then by the above definition $$Y_k = \sum_{n=0}^{N-1} { x_n \left ( e^{j 2 \pi \frac{k_0 n}{N}} \right) e^{j 2\pi\frac{k n}{N}}}$$

But I can simplify this: $$Y_k = \sum_{n=0}^{N-1} { x_n e^{j 2\pi\frac{(k + k_0) n}{N}}}$$

However, you can pretty much visually compare this with my first equation, to get $Y_k = X_{k + k_0}$.

Which is a really hugely long-winded way of saying that if you multiply by a rotating vector ($e^{j \omega t}$) in the time domain, then the result has a spectrum that's shifted up by the frequency of the rotating vector. In your case, the vector has a negative frequency (because $\cos 2 \pi f t - j \sin 2 \pi f t = e^{-j 2 \pi t}$), so you're shifting whatever interesting thing is happening at $f_0$ down to DC.

  • $\begingroup$ So, long story short, it's removing the carrier? $\endgroup$
    – Mast
    Commented Oct 22, 2019 at 8:20
  • $\begingroup$ No. If it were removing the carrier it would be doing a bunch of work to ignore or subtract out the energy at the carrier frequency. This is moving the energy at the carrier frequency around so that it can get just the signal around the carrier. It's a variant of I/Q demodulation (and I'm going to edit my answer to point that out). $\endgroup$
    – TimWescott
    Commented Oct 22, 2019 at 15:09
  • $\begingroup$ Right, an important difference. Thank you. $\endgroup$
    – Mast
    Commented Oct 22, 2019 at 15:54
  • $\begingroup$ This is awesome. You know, if I'd thought even medium-hard about the DEFINITION of the DFT, I'd have probably figured this out! Thanks for the detailed reply. $\endgroup$
    – Ben S.
    Commented Oct 22, 2019 at 15:55

The answer from Bird has it right.

The described setup is an implementation of a lock-in amplifier.

Lock in amplifiers act as very narrow band filters for detecting the presence of a known signal that is buried in noise.

If you multiply two signals (both simple sine waves) you get a new signal that contains a frequency that is the sum of the original two signals and a frequency that is the difference of the original two signals. (1000Hz * 200Hz gives an output of 800Hz mixed with 1200Hz.) This process is used in radio receivers to bring the received radio signal down to a frequency where it is more convenient to do further processing.

Your LabView program makes use of this effect to detect the amplitude and phase of the signal in comparison to a reference signal.

The difference of the input signal and the reference signal is a signal of 0Hz - that's DC. You get it out of bin 0 in your FFT results.

If the frequency of the input and the reference are not the same, then the difference lands in another bin and is ignored by your detector.

That also makes sense of removing the DC offset from the sample sets - any real DC in the input would cover generated DC from the heterodyning step.

As to why your device is doing that, it is probably so that it can recover a transmitted signal to tell how much of it is coming back to the receiver, and do it pretty much no matter how weak the received signal is or how much noise is present.

Since you say it also takes the phase of the output, it may be using it as part of measuring a distance.

You don't say what the result is used for, or in what conditions you use it so there's not really much more I can say about the "why."

  • $\begingroup$ Thanks for the response! This instrument is used to detect incredibly small sound waves generated by the photoacoustic effect, specifically for small carbonaceous particles (like smoke, for example). The phase information is used to get a qualitative measure of the size of the particles being studied. $\endgroup$
    – Ben S.
    Commented Oct 22, 2019 at 15:57
  • $\begingroup$ So, I guess you know beforehand what frequency of sound your particles will generate. Erk "photoacoustic effect." Seriously weak signals. $\endgroup$
    – JRE
    Commented Oct 22, 2019 at 16:01
  • $\begingroup$ OK. I looked up the photoacoustic effect. Your light is modulated with a known frequency ($f_0$ as you called it.) Then it really makes sense - you are detecting a known frequency, so a lock-in amplifier makes sense. $\endgroup$
    – JRE
    Commented Oct 22, 2019 at 20:53

When you multiply an $x(n)$ time-domain sequence by $e^{-j2\pi f_on/F_s}=\cos(2\pi f_on/F_s)-j\sin(2\pi f_on/F_s)$ you obtain a complex-valued sequence whose spectrum is $x(n)$'s spectrum shifted in the negative-frequency direction by $f_o$ Hz. So if $x(n)$ had a spectral component at $+f_o$ Hz, that spectral component will show up at DC (zero Hz) in the new sequence. And the phase of the new sequence's DC spectral component will be the phase of $x(n)$'s $+f_o$ spectral component.

  • $\begingroup$ @Fat32. I don't see how your "edit" changed my Answer. $\endgroup$ Commented Oct 23, 2019 at 10:58
  • $\begingroup$ I've just replaced $cos$ with $\cos$... You can re-edit your answer if you wish to get rid of my picture from appearing there :-) [that's what I do at such times] $\endgroup$
    – Fat32
    Commented Oct 23, 2019 at 21:47
  • $\begingroup$ @Fat32. Ah ha, OK. No editing needed, for your picture is a nice picture. $\endgroup$ Commented Oct 24, 2019 at 11:55
  • $\begingroup$ Thanks Mr.Lyons, not as cool as yours, but it's ok... $\endgroup$
    – Fat32
    Commented Oct 24, 2019 at 21:13

Looks to me like a Lock-In Amplifier

  • $\begingroup$ @MBaz Just having the term to search on will be a big help. But given that the demodulation is happening at a fixed frequency, I'm not sure it's accurate to call it a lock in amplifier, although I suppose that lock in amplifiers have free-run modes. $\endgroup$
    – TimWescott
    Commented Oct 22, 2019 at 15:06
  • $\begingroup$ @TimWescott Alright -- thanks for the feedback. $\endgroup$
    – MBaz
    Commented Oct 22, 2019 at 15:32

i do not know what the latter half of step 1 is.

step 2 is unnecessary (assuming $f_0$ is not zero).

step 4 and step 5 are unnecessary.

step 6 can be done with averaging. because you bumped the spectrum down by multiplying by $ e^{-j 2 \pi f_0 t} = \cos(2 \pi f_0 t) -j \sin(2 \pi f_0 t)$, the component at frequency $f_0$ is now bumped down, real and imaginary parts, to DC.

averaging gets the DC component.

  • $\begingroup$ You're definitely right that performing FT and then taking only the DC component of that is silly. About steps 2 and 4 being unnecessary I wouldn't be so sure though – this could well make sense to surpress spectral leakage. Though still – the whole thing does sound overcomplicated. $\endgroup$ Commented Oct 22, 2019 at 9:00
  • $\begingroup$ You're right that averaging gets us the DC component, but we're also interested in a few values around f0, which was unnecessary to the OP (classic X-Y problem). Averaging a few values around f0 gives us this instrument's definition of noise. $\endgroup$
    – Ben S.
    Commented Oct 22, 2019 at 15:19
  • $\begingroup$ Rather than averaging the frequency-translated samples, we should sum the frequency-translated samples to produce the correct complex-valued spectral DC (zero Hz) sample. $\endgroup$ Commented Oct 23, 2019 at 11:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.