# Signal amplitude to FFT amplitude

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)

• 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. – Fat32 Jun 20 '17 at 15:25
• Code is usually helpful if you want specific answers. – Stephen Rauch Jun 20 '17 at 15:51
• Can you use a notch filter to get rid of the signal of dis-interest? – jeremy Jun 21 '17 at 21:00
• This question was already answered here – Andrei Keino Oct 7 '17 at 20:11

## 1 Answer

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

To perform spectral analysis of $$x_a(t)$$, sample it with a period of $$T_s$$ resulting in the discrete-time sequence $$x[n] = A \cos( \omega_0 n + \theta)$$ where $$\omega_0 = \Omega T_s$$ is the discrete-time frequency in radians.

Consider the relationship between the CTFT $$X_a(\Omega)$$ of $$x_a(t)$$ and the DTFT $$X(e^{j\omega})$$ of $$x[n]$$ for $$\omega \in [-\pi,\pi]$$

$$X(e^{j\omega}) = \frac{1}{T_s} X_a(\frac{\omega}{T_s})$$

Computation of $$X(e^{j\omega})$$ of $$x[n]$$ may require indefinetely long duration of $$x[n]$$, such as infinite duration if $$x_a(t)$$ is an ideal sine wave. And also $$X(e^{j\omega})$$ is a function with continuous domain of $$\omega$$. Thus it's not practical to compute the DTFT.

However, one can compute samples $$X[k]$$ of $$X(e^{j\omega})$$, known as the DFT of $$x[n]$$, defined over a finite length of $$x[n]$$ obtained by applying 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.