【问题标题】:Amplitude and Phase analysis幅度和相位分析
【发布时间】:2017-11-13 02:45:21
【问题描述】:

我在数据分析方面遇到了一些问题。我有大量数据写如下:

-0,30273438;-0,06835938;
-0,29785156;-0,05371094;
-0,28320313;-0,04882813;
-0,28808594;-0,06347656;
-0,27343750;-0,03417969;
-0,24414063;-0,03906250;
-0,24414063;-0,01464844;

我写了一个为 2 个向量构建图形的小程序:

 import csv
 import matplotlib.pyplot as plt
 import matplotlib.dates as mdates
 import numpy as np

 x = []
 y = []

 with open('20283.dat', newline='') as csvfile:
     trash = csv.reader(csvfile, delimiter=';')
     for row in trash:
         x.append(float(row[0].replace(",", ".")))
         y.append(float(row[1].replace(",", ".")))
 #print(x)
 z = len(x)
 #print(t)
 t = np.arange(z)
 plt.figure(1)
 plt.plot(t,x, label='signal')
 plt.xlabel('timing')
 plt.ylabel('x')
 plt.title('First channel')
 plt.legend()
 plt.figure(2)
 plt.plot(t,y, label='signal')
 plt.xlabel('timing')
 plt.ylabel('y')
 plt.title('Second channel')
 plt.legend()

 plt.show()

如何获得幅度谱和相位谱?以及如何实现可自定义的简单移动平均滤波器(窗口大小、时间步长、开始和停止点)?

【问题讨论】:

  • 学习数学,阅读文档,寻找其他库,如果你使用的库没有你需要的,用你自己的函数实现数学,编写代码。

标签: python matplotlib fft jupyter-notebook


【解决方案1】:

对于 python,numpyscipy 通常是您要查找线性代数的地方。

对于移动窗口功能,请查看pandas,它与numpy 具有相当的互操作性,并以有用的方式扩展了numpy 功能。

https://scipy.org/

https://docs.scipy.org/doc/numpy-dev/user/quickstart.html

https://docs.scipy.org/doc/scipy/reference/

http://pandas.pydata.org/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-05-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多