Should we divide the power at 0Hz by two for Single-Sided Power Spectrum with FFT? To make my question as clear as possible I will go through an example. I want to plot one sided power spectrum of a signal. As an example my signal is sum of &quot;50Hz sine with and amplitude of 1V&quot; and &quot;DC offset voltage of 1V&quot;. I create this signal and plot FFT of it where I define the power as amplitude square divided by two.
Here is my code:
import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
import scipy.fftpack

f = 50 #signal freq
D = 1 #duration
fs = 800 #sampling freq
T = 1/f #signal period
N = int((D/(1/fs))+1) #number of smaples
 
t = np.linspace(0, D, num=N, endpoint=True) #time vector
dc = 1
y = np.sin(2*np.pi*f*t) + dc 

plt.plot(t, y,'-b')
plt.plot(t, y,'.r')
plt.title('~ Sinusoid ~')
plt.xlabel('time [s]')
plt.ylabel('Voltage [V]')
plt.grid()
plt.show()

#FFT
plt.figure()
y = y
T = t[2]-t[1]
sampling_rate = 1/T
N = len(y)
yf = scipy.fftpack.fft(y)
xf = np.linspace(0.0, 1.0/(2.0*T), N//2)
amplitude = 2.0/N * np.abs(yf[:N//2])
pow = amplitude*amplitude/2

plt.plot(xf, pow,'b')
plt.grid()
plt.xlabel('Frequency [Hz]')
plt.ylabel('Power [W]')



Now the rms power for the sine component can be calculated as (amplitude square)/2 which is 0.5W and this is what we see at the plot above.
And for the 1V DC component, I would say the rms power is (amplitude square) which is 1W. But the plot shows twice of it namely 2W.
My question is: Should I divide the power by two at 0Hz at FFT plot in my code or am I interpreting something wrong?
The factor of &quot;2&quot; comes from the contribution of the negative frequencies, which doesn't apply to DC.
A better way to plot this is to NOT multiply with 2 but plot the entire FFT range from -400Hz to +400Hz. There you will see three components: 1 W at DC and 0.25W each at -50Hz and +50Hz which is exactly what's happening here.
If you want to plot power spectrum one sided, you need to multiply by two EXCEPT for DC and Nyquist, which have no negative frequency equivalent.