Convergence of the Fourier Transform
01 spectrum energy
Convergence of the Fourier Transform
1. Spectrum energy
In the previous blog post, two spectra with infinitely many discontinuity functions were discussed. The respective spectra of the two signals have different decay rates. Let's compare the spectral attenuation of these two signals as the frequency increases through numerical simulation.
2. Square wave signal
This is a square wave signal and its corresponding spectrum. The width and height of the square wave is 1, and the frequency spectrum corresponds to the sinc function whose height is 1. The energy of the signal is 1, and the energy of the frequency spectrum is 2 Pi, which is the energy conservation principle of Fourier transform.
As for the spectrum energy, examine its energy under the limited bandwidth, and study its variation law with the increase of the bandwidth. As M tends to infinity, the energy limit tends to 2 Pi, discuss the law of error attenuation.
The trend of the spectrum energy error changing with the increase of the integration bandwidth is given here. The abscissa is the bandwidth, and the ordinate is the logarithm of the error. At 10 Hz, the error drops to 0.0316.
▲ 图1.2.1 积分带宽能量误差变化情况
#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# TEST1.PY -- by Dr. ZhuoQing 2023-04-10
#
# Note:
#============================================================
from headm import *
t = linspace(-10000, 10000, 1000000)
ts = (max(t)-min(t))/(len(t)-1)
def G(t, startn, endn):
return heaviside(t-startn,0.5)-heaviside(t-endn,0.5)
def Gt(t, center, width):
startn = center-width/2
endn = startn + width
return heaviside(t-startn,0.5)-heaviside(t-endn,0.5)
ft = G(t, -0.5, 0.5)
Ft = sinc(t/pi)
Eft = sum(ft**2)*ts
E2Ft = Ft**2*ts*2
Eall = sum(E2Ft)
c = len(t)//2
cn = len(t)//2
N = 200
edim = []
fdim = []
#------------------------------------------------------------
for n in range(N):
nn = int(cn*n/N/100)
f = t[c+nn]/2/pi
fdim.append(f)
Err = Eall-sum(E2Ft[c-nn:c+nn])
edim.append(log(Err)/log(10))
plt.clf()
plt.plot(fdim, edim, lw=3)
plt.xlabel("Band Width(Hz)")
plt.ylabel("log10(Err)")
plt.grid(True)
plt.tight_layout()
plt.draw()
plt.pause(.001)
pltgif.append(plt)
pltgif.save()
#------------------------------------------------------------
plt.plot(t, ft, lw=3, label='f(t)')
plt.plot(t, Ft, lw=3, label='F(omega)')
plt.xlabel("t, omega")
plt.ylabel("f(t),F(omega)")
plt.grid(True)
#plt.grid(False)
plt.legend(loc='upper right')
plt.axis([min(t)-(max(t)-min(t))/20, max(t)+(max(t)-min(t))/20, -1.00, 3.00])
plt.tight_layout()
plt.show()
#------------------------------------------------------------
# END OF FILE : TEST1.PY
#============================================================
3. Monotone rectangular wave
For a square wave signal that falls monotonically with infinite discontinuities, this is its spectrum curve. Similarly, calculate how the error changes as the bandwidth increases. The error also decreases monotonically. At 10Hz, the error is 0.0794.
▲ 图1.3.1 频谱误差变化情况
4. Infinite oscillating rectangular wave
For an infinitely oscillating rectangular wave, its corresponding spectrum decays relatively slowly. The fluctuation is relatively large. Here it is shown how its error varies with the integration bandwidth. When zl is 10Hz, the corresponding error is about 0.79.
▲ 图1.4.1 频谱误差变化情况
5. Contrast error attenuation
Three waveform error attenuation situations are given here, and it can be seen that the error difference between them is about 10.3 times, which is the case of comparison in a larger spectrum range. As the bandwidth tends to infinity, their slopes tend to be the same. This means that both of these three waveforms converge in such a way that the error energy decays to zero.
▲ 图1.5.1 三种波形误差对比
▲ 图1.5.2 三种波形误差对比
▲ 图1.5.3 三种波形误差对比
#!/usr/local/bin/python
# -*- coding: gbk -*-
#============================================================
# TEST1.PY -- by Dr. ZhuoQing 2023-04-10
#
# Note:
#============================================================
from headm import *
t = linspace(-10000, 10000, 1000000)
ts = (max(t)-min(t))/(len(t)-1)
def G(t, startn, endn):
return heaviside(t-startn,0.5)-heaviside(t-endn,0.5)
def Gt(t, center, width):
startn = center-width/2
endn = startn + width
return heaviside(t-startn,0.5)-heaviside(t-endn,0.5)
c = len(t)//2
cn = len(t)//2
N = 200
#------------------------------------------------------------
ft = G(t, -0.5, 0.5)
Ft = sinc(t/pi)
Eft = sum(ft**2)*ts
E2Ft = abs(Ft)**2*ts*2
Eall = sum(E2Ft)
edim1 = []
fdim1 = []
for n in range(N):
n+=1
nn = int(cn*n/N/2)
f = t[c+nn]/2/pi
fdim1.append(f)
Err = Eall-sum(E2Ft[c-nn:c+nn])
edim1.append(log(Err)/log(10))
#------------------------------------------------------------
Ft = t*0
N = 100
for n in range(N):
Ft = Ft + 2**-(n+2)*sinc(2**-(n+3)*t/pi)*exp(-1j*t*(1-3*2**-(n+2)))
Eft = sum(ft**2)*ts
E2Ft = abs(Ft)**2*ts*2
Eall = sum(E2Ft)
edim2 = []
fdim2 = []
for n in range(N):
n+= 1
nn = int(cn*n/N/2)
f = t[c+nn]/2/pi
fdim2.append(f)
Err = Eall-sum(E2Ft[c-nn:c+nn])
edim2.append(log(Err)/log(10))
#------------------------------------------------------------
Ft = t*0
N = 100
for n in range(N):
# Ft = Ft + 2**-(n+2)*sinc(2**-(n+3)*t/pi)*exp(-1j*t*(1-3*2**-(n+2)))
Ft = Ft + 2**(-2*n-1)*sinc(2**(-n-2)*t/pi)*exp(-1j*t*(1-3/4*2**(-n)))
Eft = sum(ft**2)*ts
E2Ft = abs(Ft)**2*ts*2
Eall = sum(E2Ft)
edim3 = []
fdim3 = []
for n in range(N):
n+= 1
nn = int(cn*n/N/2)
f = t[c+nn]/2/pi
fdim3.append(f)
Err = Eall-sum(E2Ft[c-nn:c+nn])
edim3.append(log(Err)/log(10))
plt.plot(fdim1, edim1, lw=3, label='sinc')
plt.plot(fdim2, edim2, lw=3, label='F1(t)')
plt.plot(fdim3, edim3, lw=3, label='F2(t)')
plt.xlabel("Band Width(Hz)")
plt.ylabel("log10(Err)")
plt.grid(True)
plt.legend(loc="upper right")
plt.tight_layout()
plt.show()
#------------------------------------------------------------
for n in range(N):
n+= 1
nn = int(cn*n/N/2)
f = t[c+nn]/2/pi
fdim.append(f)
Err = Eall-sum(E2Ft[c-nn:c+nn])
edim.append(log(Err)/log(10))
plt.clf()
plt.plot(fdim, edim, lw=3)
plt.xlabel("Band Width(Hz)")
plt.ylabel("log10(Err)")
plt.grid(True)
plt.tight_layout()
plt.draw()
plt.pause(.001)
pltgif.append(plt)
pltgif.save()
plt.show()
#------------------------------------------------------------
plt.plot(t, ft, lw=3, label='f(t)')
plt.plot(t, Ft, lw=3, label='F(omega)')
plt.xlabel("t, omega")
plt.ylabel("f(t),F(omega)")
plt.grid(True)
#plt.grid(False)
plt.legend(loc='upper right')
plt.axis([min(t)-(max(t)-min(t))/20, max(t)+(max(t)-min(t))/20, -1.00, 3.00])
plt.tight_layout()
plt.show()
#------------------------------------------------------------
# END OF FILE : TEST1.PY
#============================================================
※ Summary ※
This paper discusses the convergence of the Fourier spectrum of the three signals. Numerical simulation results prove that they are all energy convergent.
■ Links to related literature:
- Compare the spectra of two signals with infinite discontinuities
- Convergence of the Fourier Transform
● Links to related diagrams: