高斯脉冲的函数如下:
x
(
t
)
=
e
−
t
2
2
∗
σ
2
x(t)=e^{frac{-t^2}{2* sigma ^2}}
x(t)=e2∗σ2−t2
生成高斯脉冲流的代码如下:
import numpy as np
import matplotlib.pyplot as plt
import math
import scipy.signal
fs = 1000 #采样率
dt = 1/fs #采样间隔
simuT = 1 #仿真时间
L = 5 #Dirac脉冲数,2*L即新息率
B = 10 #采样核带宽
simuTime = np.arange(0,simuT,dt) #仿真时间向量,步长为dt,起点为0,终点为1,不包含终点,因此它从0开始,不包括simuT
gauss_t = np.arange(-simuT/2,simuT/2,dt)
sigma = 0.01; #标准差
variance = sigma**2; #方差
ak = np.array([0.4, 0.6, 0.3, 0.9, 0.7]) #幅值
tk = np.array([0.1, 0.3, 0.5, 0.7,0.9]) #时延,单位为秒
tk_index = (tk*fs).astype(np.int32) #脉冲流信号的脉冲位置的下标,下标必须是整数,astype()用于强制类型转换
N = simuTime.size #信号的长度
x = np.zeros((N)) #生成全零的仿真信号
gaussPulse = np.exp(-gauss_t**2/(2*variance))
for i in range(L):
x = x + ak[i]*(np.exp(-(simuTime-tk[i])**2/(2*variance)))
## 绘图
plt.figure(1)
plt.subplot(2,1,1)
plt.plot(gauss_t,gaussPulse)
plt.title('Gauss pulse')
plt.subplot(2,1,2)
plt.plot(simuTime,x)
plt.title('Gauss pulse stream')
plt.show()
绘图如下:



