小编hoa*_*gpx的帖子

IOS - 按顺序加载本地文件

我在app的Document文件夹中有一个图像列表.我想按照创建日期的顺序加载图像.我怎样才能做到这一点 ?

objective-c nsfilemanager ios

3
推荐指数
1
解决办法
1355
查看次数

需要解释specgram函数如何在python中工作(matplotlib - MATLAB兼容函数)

我正在努力将我的代码从 python 转换为目标 c。在 matplotlib.mlab.specgram 函数中,我在 fft 之前看到了 3 个重要的函数:

 result = stride_windows(x, NFFT, noverlap, axis=0)
 result = detrend(result, detrend_func, axis=0)
 result, windowVals = apply_window(result, window, axis=0,
                                      return_window=True)
 result = np.fft.fft(result, n=pad_to, axis=0)[:numFreqs, :]
Run Code Online (Sandbox Code Playgroud)

我试图调试以了解每个的目的。例如我有输入数组:

x = [1,2,3,4,5,6,7,8,9,10,11,12]
Run Code Online (Sandbox Code Playgroud)

在第一个函数 stride_windows 之后(这个是为了防止泄漏?),如果 NFFT = 4,noverlap = 2 那么:

x = [ [1,3,5,7,9],
      [2,4,6,8,10],
      [3,5,7,9,11],
      [4,6,8,10,12] 
    ]
Run Code Online (Sandbox Code Playgroud)

在 detrend 之后没有任何变化(我了解 fft 之前的 detrend)

在 apply_window 里面(我不明白这一步):

    xshape = list(x.shape) 
    xshapetarg = xshape.pop(axis) // =4
    windowVals = window(np.ones(xshapetarg, dtype=x.dtype))
    //result of 4 elements …
Run Code Online (Sandbox Code Playgroud)

python signal-processing fft matplotlib spectrogram

2
推荐指数
1
解决办法
1233
查看次数