求矩阵序列的周期性

2024-04-24 19:27:57 发布

您现在位置:Python中文网/ 问答频道 /正文

下面是包含许多列的csv文件的快照(实际文件非常大)。每一列对应于“系统状态”的时间戳值。我想要找到的是这些列出现的周期,即系统状态是否会重复自身以及以什么周期出现。我一直在寻找python中的fft2,但现在还不了解句点提取。请帮助,因为我不是新的傅立叶变换和没有以前的知识。你知道吗

一个矩阵表示在一列中。前两列用于矩阵单元识别。大多数值都是零,但不是全部。你知道吗

enter image description here

我的程序的算法步骤

import numpy as np

from numpy import fft

#there is mxn array where each column is a state of a system at increasing timestamps.

a=np.array([ [1,2,3,4], [11,12,13,14], [1,2,3,4,], [11,12,13,14], [1,2,3,4], [11,12,13,14] ])

#i have to find the periodicity of this np array where each column is a state of system. hence here state of the system repeats itself at period of 2. 

#if array is as follows

a=np.array([ [1,2,3,4], [11,12,13,14],[2,4,6,8], [1,2,3,4,], [11,12,13,14],[2,4,6,8], [1,2,3,4], [11,12,13,14], [2,4,6,8] ])

#i look periods 3 ......if array is aperiodic I will look for an approximation to period of the array

#can numpy.fftpack is of use to me? can i achieve it using np.fft.fft2(a). I couldnot understand it thouroughly. 

Tags: 文件ofthetoimportnumpyis状态