python - 如何在 Python 中执行 Matlab 函数“pspectrum”(可能使用 numpy)
问题描述
我想分析几秒钟的声音并直观地查看整个声音中使用的每个频率的功率。在 matlab 中,我可以使用函数 pspectrum 并得到一些看起来像
有没有办法在 python 中使用 numpy 或类似的库来做到这一点?
解决方案
在 python 中执行频谱图有两种方法。首先,使用 scipy 库,其次使用 matplotlib 库。scipy 库是最常用的,因为整个 scipy 库都是用于信号处理的。此外,matplotlib 谱图函数比 scipy 具有更多的功能。
我会说使用 matpoltlib 函数,因为 matplotlib 库是专门用于可视化的。请找到两个库文档的链接。
为频谱安装 python 库:1.) scipy library = pip install scipy(文档 - https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.spectrogram.html)
2.)matplotlib 库 = pip install matplotlib(文档- https://matplotlib.org/api/_as_gen/matplotlib.axes.Axes.specgram.html#matplotlib.axes.Axes.specgram)
免费提出与此主题相关的更多问题。祝你好运!
推荐阅读
- python - 通过 POST 请求从 Bootstrap Modal 获取数据
- c - 如何隐藏进程窗口
- javascript - 为什么在 React 中调用 'setState()' 时使用扩展运算符?
- html - :checked 不能在带有伪元素的 CSS 中工作
- r - 将正则表达式匹配从一列放入第一列,NA逐行
- bash - 为什么有些命令错误地用单引号括起来?
- python - 管道错误:“AttributeError:‘ColumnTransformer’对象没有属性‘_feature_names_in’”
- python - 无法抓取动态网页
- spring-boot - NullPointerException @Autowired Mongodb 集合
- javascript - 如果属性值相等,则获取列表中的第一个元素 - VUE.js