Python 中正弦信号的频率和时间频率域特征

Frequency and time-freqeuncy domain features for a sinusoidal signal in Python

提问人:NN_Developer 提问时间:8/2/2023 更新时间:8/2/2023 访问量:20

问:

我在 Python 中创建了以下正弦波信号:

# Import libraries
import numpy as np
import matplotlib.pyplot as plt

Fs  = 1000                                              # Sampling frequency (Hz)
T   = 10                                                # Duration of time signal (s)
N   = T*Fs                                              # Number of data points
f   = 10                                                # Frequency of the sine wave signal (Hz)
t   = np.linspace(0, T, N)                              # Time axis data points
y   = 10 * np.sin(2*np.pi*f*t)                          # Amplitude of the sine wave signal

plt.figure(figsize=(8,8))                               # Figure size of the plot
plt.plot(t,y)                                           # time history plot of the sine wave
plt.xlabel('Time (s)')                                  # X-axis label
plt.ylabel('Amplitude')                                 # Y-axis label
##plt.xlim([0,2.5])                                     # X-axis limits
##plt.ylim([-8,18])                                     # Y-axis limits
plt.get_current_fig_manager().window.state('zoomed')    # Maximize the plot for full screen
plt.show()                                              # Show the plot

有人可以帮我了解以下几点吗:

  1. 从 10 秒正弦波信号 Python 中可以提取出哪些各种“频域特征”?

  2. 在 Python 中,可以从 10 秒正弦波信号中提取出哪些“时间频率域特征”?

  3. 我们如何在 Python 中计算这个 10 秒正弦波信号的小波包能量和小波包熵?

python-3.x 信号处理 分析 频率 分布 时间频率

评论


答:

1赞 some3128 8/2/2023 #1

对于第一个问题,请考虑信号的时域特性,以及它们在频率方面的含义。特别是,信号的主要频率是多少;它是无限的还是被截断的;以及采样的性质是什么(采样频率)。这些都有助于信号的频率特性。

关于第二个问题,from 提供了信号的时频渲染。请注意,您在一个频率上有很多功率,并且您有一些功率泄漏到相邻频率。specgram()matplotlib

enter image description here

plt.specgram(y, N, Fs)
plt.xlabel('time')
plt.ylabel('Frequency')
plt.ylim(0, 50)