在FFT上登录结果 [英] Sign on results of fft

查看:110
本文介绍了在FFT上登录结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从测试目标中计算MTF.我可以很容易地计算出扩频函数,但是FFT结果对我来说并没有太大意义.总而言之,这些价值观似乎交替出现,使我对我的期望有所反映.为了进行测试,我使用了一个简单的方波和numpy:

I am attempting to calculate the MTF from a test target. I calculate the spread function easily enough, but the FFT results do not quite make sense to me. To summarize,the values seem to alternate giving me a reflection of what I would expect. To test, I used a simple square wave and numpy:

from numpy import fft

data = []
for x in range (0, 20):
    data.append(0)

data[9] = 10
data[10] = 10
data[11] = 10

dataFFT = fft.fft(data)

结果看起来正确,除了符号...我以前四个值为例:

The results look correct, with the exception of the sign... I am seeing the following for the first 4 values as an example:

30.00000000 + 0.00000000e + 00j

30.00000000 +0.00000000e+00j

-29.02113033 + 7.10542736e-15j

-29.02113033 +7.10542736e-15j

26.18033989 -1.24344979e-14j

26.18033989 -1.24344979e-14j

-21.75570505 + 1.24344979e-14j

-21.75570505 +1.24344979e-14j

所以我的问题是,为什么在真实平面中出现正->负->正->负?这不是我所期望的...我将其绘制出来,几乎可以看出正确的功能是围绕x轴镜像的.

So my question is why positive->negative->positive->negative in the real plane? This is not what I would expect... It I plot it, it almost appears that the correct function is mirrored around the x axis.

注意:我期望以下示例为例:

Note: I was expecting the following as an example:

这就是我得到的:

推荐答案

您的脉冲是对称的,并位于FFT窗口的中心(大约N/2).对称实数仅对应于FFT结果的余弦或实数"分量.请注意,取决于频率仓索引(代表每个FFT宽度的余弦周期),余弦函数在FFT窗口的中心在-1和1之间交替变化.因此,只要这些脉冲的宽度小于余弦周期的一半,这些FFT基函数与正向脉冲的相关性也会交替变化.

Your pulse is symmetric and positioned in the center of your FFT window (around N/2). Symmetric real data corresponds to only the cosine or "real" components of an FFT result. Note that the cosine function alternates between being -1 and 1 at the center of the FFT window, depending on the frequency bin index (representing cosine periods per FFT width). So the correlation of these FFT basis functions with a positive going pulse will also alternate as long as the pulse is narrower than half the cosine period.

如果您希望最大的FFT系数大部分为正,请尝试将窄矩形脉冲居中在时间0(或圆形,时间N)附近,在该频率下,任何频率的余弦函数始终为1.

If you want the largest FFT coefficients to be mostly positive, try centering your narrow rectangular pulse around time 0 (or circularly, time N), where the cosine function is always 1 for any frequency.

这篇关于在FFT上登录结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆