如何计算从实值输入输出的fft()的幅度和相位角? [英] How do I calculate amplitude and phase angle of fft() output from real-valued input?

查看:58
本文介绍了如何计算从实值输入输出的fft()的幅度和相位角?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有24个来自实值信号的样本.我对示例执行fft()函数,并获得复杂的输出.我想获得每个非冗余谐波的幅度和相位角.我知道我的计算必须考虑别名,因为我有实值数据.我如何:

I have 24 samples from a real-valued signal. I perform the fft() function on the sample and get the complex output. I want to obtain the amplitude and phase angle of each of the non-redundant harmonics. I know my calculation must account for aliasing since I have real-valued data. How do I:

(1)从两面转换为单面傅里叶变换,

(1) convert from the two-sided to a one-sided Fourier transform,

我在这里听到了几件事.例如,是否将前12个谐波(即fft()输出的2至13个元素)乘以2,然后将其余的谐波(即,保持fft()输出的1至13个元素)相减?

I've heard several things here. For example, do I multiply the first 12 harmonics (i.e., 2nd through 13th elements of fft() output) by two and drop the rest of the harmonics (i.e., keep 1st through 13th elements of fft() output)?

(2)计算单边傅立叶变换的幅度,

(2) calculate the amplitude of the one-sided Fourier transform,

我知道我可以使用Mod()函数,但是什么时候可以这样做?从双面转换为双面之前还是之后?

I know I can use the Mod() function, but when do I do this? Before or after I convert from two- to one-sided?

(3)计算单面傅立叶变换的相位角.

(3) calculate the phase angle of the one-sided Fourier transform.

我知道我可以在fft()输出的虚部与实部的比率上使用atan()函数,但是同样,我什么时候这样做?双面转换之前还是之后?另外,如果atan未定义怎么办?

I know I can use the atan() function on the ratio of imaginary to real parts of the fft() output, but again, when do I do this? Before or after two- to one-sided conversion? Also, what if atan is undefined?

谢谢.

推荐答案

由于您的输入是真实的,因此FFT的输出将关于N/2对称,因此您只需查看第一个N/2个bin并缩放幅度即可理想情况下,相乘2倍.对于相位,理想地需要atan2函数,该函数将实部和虚部作为单独的参数,并返回4象限结果.

Since your input is real the output of the FFT will be symmetric about N / 2 so you can just look at the first N / 2 bins and scale the magnitude by a factor of 2. For the phase you ideally need an atan2 function which takes the real and imaginary components as separate arguments and returns a 4 quadrant result.

这篇关于如何计算从实值输入输出的fft()的幅度和相位角?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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