BeichenPeng 发表于 2014-1-19 20:55:57

ALTERA的FFT疑问

本帖最后由 BeichenPeng 于 2014-1-19 21:01 编辑

如何将source_real(实部)和source_imag(虚部)结合转换成幅度数值呢?
source_exp = b110111,即 -9;
source_real = 2;source_imag = 0;
是不是幅值 = 2 * POWER(2,9) + 0i = 1024?

搞过FFT的指导一下,谢谢!

笑笑我笑了 发表于 2014-1-19 21:41:44

sqrt((real)^2+(imag)^2)

BeichenPeng 发表于 2014-1-19 22:09:01

笑笑我笑了 发表于 2014-1-19 21:41
sqrt((real)^2+(imag)^2)



谢谢!和source_exp无关吗?

用户手册:
Unlike an FFT block that uses floating point arithmetic, a block-floating-point FFT
block does not provide an input for exponents. Internally, a complex value integer
pair is represented with a single scale factor that is typically shared among other
complex value integer pairs. After each stage of the FFT, the largest output value is
detected and the intermediate result is scaled to improve the precision. The exponent
records the number of left or right shifts used to perform the scaling. As a result, the
output magnitude relative to the input level is:
output*2-exponent
For example, if exponent = –3, the input samples are shifted right by three bits, and
hence the magnitude of the output is output*23.

我在excel里做了一个sin函数,用excel自带的傅里叶转换后得出的频率图基本是对的。将信号数据拷贝到FFT_1_real_input.txt(FFT_1_imag_input.txt全为0)后用ModelSim仿真得出的曲线感觉不对。

FFT是16位1024点连续Streaming。第一次搞这个,头绪都没有。

见图:



仿真流程貌似正确。








gc56198 发表于 2014-1-19 22:21:13

没用过,不过感觉他像是科学计数法表示
有市部和虚部,复变函数告诉我们,可以得到幅度和角度。

笑笑我笑了 发表于 2014-1-19 22:47:32

这个是定点FFT,-9应该是表示右移9位所以应该是real*2^-9吧。但是用户手册最后面的那个例子实在是费解啊,为什么是output*23.

BeichenPeng 发表于 2014-1-20 15:23:00

对的,我已经搞懂了。目前excel、ModelSim和matlab出来的结果基本是一致的。如果指数是-3,则实部应该是乘以2的3次方;指数是-9就要乘以2的9次方。excel里可以用COMPLEX将实部和虚部组合成复数;用IMABS将复数转换成模数;再除以N/2(N是采样点数)就是信号的幅值。
不过我的目的是要判断出一串信号里是否存在超过某种频率的高频信号,譬如对一个连续的AD信号做1024点FFT分析,如果有超过某频率的成分就输出1,否则输出0。如何对这些实部虚部数据进行分析,谁能提供一些建议?
页: [1]
查看完整版本: ALTERA的FFT疑问