信号处理:采样率与采样周期



让我们考虑以下代码:

f = 40;  # Hz
tmin = -0.3;
tmax = 0.3;
t, sampling_period = linspace(start=tmin, stop=tmax, num=400, retstep=True); # here I am saying split in 400 regular interval the 0.6 units of times. 
# Based on the above, I obtain the distance between two regular intervals of 0.0015 = 0.6/400 ==> 
# sample period T = 0.0015
significant_digits = 2
rounded_sampling_period = round(sampling_period, significant_digits - 
int(math.floor(math.log10(abs(sampling_period)))) - 1)
sampling_frequency = 1/rounded_sampling_period
print("sampling_period - regular intervals of T = ", sampling_period)
print("rounded_sampling_period ", rounded_sampling_period)
print("sampling_frequency or sample rate = 1/T ", sampling_frequency)
x = cos(2*pi*f*t); # signal sampling
plot(t, x)

我得到的结果:

sampling_period - regular intervals of T =  0.0015037593984962405
rounded_sampling_period  0.0015
sampling_frequency  666.6666666666666

试图理解采样率与采样周期之间的差异有什么错?666.666没有意义?

提前感谢您的帮助。

我相信您混合了两个不同的概念,信号频率/周期和采样频率/周期。

信号频率/周期是信号自身重复的时间间隔。

样本频率/周期是样本之间的距离(在这种情况下是阵列中的点之间(

这就是为什么你得到666.66,因为你的信号在0.6秒(0.3-(-0.3((的时间内在400个数据点之间采样,这导致666.66

最新更新