I am using Python to generate a sine wave in order to cancel out part of a signal I'm analyzing. I would like the magnitude of this signal in the FFT to be equal to the magnitude of the signal that I want to get rid of. My questions are:

  • A. How does the amplitude of a signal translate to the amplitude of the resultant FFT?

  • B. Is there a way I can easily control the amplitude of an FFT using the amplitude of an input signal?

I can post my code if it helps.

This is the FFT of the signal I'm analyzing. I want the large amplitude at 1.4-ish(from the signal I generated) to be equal in magnitude to the large amplitude at 2.9-ish (the frequency I want to get rid of)

This is the FFT of the signal I'm analyzing. I want the large amplitude at 1.4-ish(from the signal I generated) to be equal in magnitude to the large amplitude at 2.9-ish (the frequency I want to get rid of)

  • 1
    $\begingroup$ You need to consider sampling period $Ts$ window length $L$ and DFT size $N$ for computing the associated scaling that applies to the continuous time Fourier transform of a given signal while its DFT is being computed and plotted. $\endgroup$ – Fat32 Jun 20 '17 at 15:25
  • $\begingroup$ Code is usually helpful if you want specific answers. $\endgroup$ – Stephen Rauch Jun 20 '17 at 15:51
  • $\begingroup$ Can you use a notch filter to get rid of the signal of dis-interest? $\endgroup$ – jeremy Jun 21 '17 at 21:00
  • $\begingroup$ This question was already answered here $\endgroup$ – Andrei Keino Oct 7 '17 at 20:11

Consider a continuous-time signal $$x_a(t) = A \cos(\Omega_0 t + \theta) $$ where $\Omega_0$ is the continuous time frequency in radians per second and $\theta$ is the phase in radians.

In order to perform a digital spectrum analysis of the continuos time signal $x_a(t)$ first sample (without aliasing) it with a period of $T_s$ seconds per sample (or with a sampling frequency of $F_s = 1/ T_s$ samples per second) resulting in the discrete-time signal $$x[n] = A \cos( \omega_0 n + \theta)$$ where $\omega_0 = \Omega T_s$ is the discrete-time frequency is radians per sample.

Next consider the relationship between the CTFT $X_a(\Omega)$ of $x_a(t)$ and DTFT $X(e^{j\omega})$ of $x[n]$ through the continuous to discrete time conversion process stated as: $$X(e^{j\omega}) = \frac{1}{T_s} X_a(\frac{\omega}{T_s})$$ which shows the relation over the first period of $X(e^{j\omega})$

Computation of the DTFT $X(e^{j\omega})$ of the sequence $x[n]$ may require indefinetely large number of samples (for example infinite if $x_a(t)$ is the ideal sine wave). However that's not practical for not only that it requires an incomprehensible amount of processing but, more importantly, also for it's not the DTFT $X(e^{j\omega})$ which is represented within the digital computer but its's DFT samples $X[k]$ which is defined over a finite length of signal.

Therefore, in order to get a finite length truncation of the input signal $x[n]$ apply a window: $$v[n] = w[n]x[n]$$ where $w[n]$ is the window of length $L$.

The consequence of this windowing on the result of the computed spectrum is: $$V(e^{j\omega}) = \frac{1}{2\pi} X(e^{j\omega}) \star W(e^{j\omega}) $$

Computing the $N$-point DFT of the sequence $v[n]$ therefore provides the samples $V[k]$ of the result of the periodical convolution between the true spectrum $X(e^{j\omega})$ of $x[n]$ and the DTFT $W(e^{j\omega})$ of the window $w[n]$. Note that $N \geq L$.

For the specific example we have considered, $$x[n]=A\cos(\omega_0 n + \theta)$$ whose DTFT is $$X(e^{j\omega})= A\pi e^{j\theta} \delta(\omega-\omega_0) + A\pi e^{-j\theta} \delta(\omega+\omega_0)$$ a pair impulses weighted by $A\pi$.

And assuming a rectangular window of length $L$ for $w[n]$, its DTFT is: $$W(e^{j\omega})= \sum_{n=0}^{L-1} w[n] e^{-j\omega n} = e^{-j{\omega (L-1)/2}} \frac{\sin(\omega L / 2)}{\sin(\omega / 2)} $$ the result is $$V(e^{j\omega}) = 0.5 A e^{j\theta} W(e^{j(\omega - \omega_0)}) + 0.5 A e^{-j\theta} W(e^{j(\omega + \omega_0)})$$

Finally the DFT samples $V[k]$ are given by the following: $$V[k] = V(e^{j\frac{2\pi k}{N} }) = 0.5 A e^{j\theta} W(e^{j(\frac{2\pi k}{N} - \omega_0)}) + 0.5 A e^{-j\theta} W(e^{j(\frac{2\pi k}{N} + \omega_0)}) $$

One peak peak of these DFT samples would occur for $\omega = \omega_0$ for some $k$ if $\frac{2\pi k}{N} = \omega_0$ is satisfied for an integer $N$ and $k$. Assuming $T_s$ ,$L$,$N$,and $\Omega_0$ are selected such that the equality is satisfied for some integer $k_0$, then the magnitude of the peak of the observed spectrum is: $$ |V[k_0]| = | 0.5 A e^{j\theta} W(e^{j(0)}) + 0.5 A e^{-j\theta} W(e^{j(2\omega_0)}) | $$

Solving for $A$, the amplitude of the original analog signal whose spectrum analysis are after, yields: $$A = \frac{2 |V[k_0]|}{|e^{j\theta} W(e^{j(0)}) + e^{-j\theta} W(e^{j(2\omega_0)}) |} $$

An approximation to this can be obtained by assuming, for the rectangular window, $W(e^{j 2\omega_0}) \approx 0$ and noting that $W(e^{j0}) = L$ : $$A \approx \frac{2 |V[k_0]|}{L}$$

If a window other than rectangular is used, formulation should be adjusted accordingly, specifically $W(0)$ being the sum of the window samples, which is $L$ for the rectangular window.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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