# Uncertainty error in phase and amplitude results of FFT MATLAB

I understand that the Matlab function FFT gives the amplitude and phases. Is there a way to find out or approximate the errors on those values?

The DFT (Discrete Fourier Transform) is a linear operation, so if you have a signal $$x[n]$$ with some additive noise $$q[n]$$ we have

$$y[n] = x[n] + q[n] \\ Y[k] = X[k] + Q[k]$$

where $$X[k]$$ is the DFT of $$x[n]$$ etc.

So the amount of contamination you get in amplitude and phase is primarily a function of the spectrum of the noise. With white noise it will be more or less equal at all frequencies, but if you have a narrow band interferer, all the noise energy would show up in only a very small number of frequency bins (possibly trashing your signal in these bins completely).

The amount of "uncertainty" is also a function of your signal energy or SNR (signal to noise ratio), so it depends on the spectrum of BOTH signal and noise. For example if your signal is pink and the noise is white, the uncertainty will be low at low frequencies and high at high frequencies.

• Nice especially the mention of possible frequency dependence. To add,l: windowing if done will increase the uncertainty for high SNR signals. Commented Sep 15, 2023 at 16:27

The uncertainty in the calculated spectral amplitudes will be related to the uncertainty in the measured time-domain signal amplitudes, the uncertainty in the time measurement, and also the sampling frequency.

For a discrete time-domain signal vector $$x[n\Delta t]$$, the frequency content is found using the Fast Fourier Transform (FFT) algorithm. The full Discrete Fourier Transform (DFT) equation that this FFT is computing in an efficient way is:

$$Y[k\Delta f] = \sum_{n=0}^{N-1} x[n\Delta t] e^{-2\pi i\frac{nk}{N}} \Delta t$$

where $$Y[k\Delta f]$$ is a vector of amplitude spectral density values. Each element represents the signal amplitude per unit frequency inside each frequency bin $$\Delta f$$. $$N$$ is the number of signal samples taken, $$\Delta t$$ is the time-step size between samples, and $$k$$ is the frequency bin number.

MATLAB's $$fft(t)$$ function actually produces $$\frac{Y[k\Delta f]}{\Delta t}$$ so the vector of values you get using this MATLAB function represent the signal amplitude within each frequency bin (but not per unit frequency).

If you have an uncertainty of $$\delta x$$ in the signal amplitude when measured in the time-domain, you have the same uncertainty in the frequency domain. I.e. $$\delta Y = \delta x$$.