简体   繁体   English

频率范围的快速傅立叶逆变换

[英]inverse fast fourier transform for frequency range

My problem is to obtain original signal from amplitude spectrum (fft) based on inverse fft but only for some frequency range ex. 我的问题是从振幅谱(fft)基于逆fft获得原始信号,但是仅在ex的某些频率范围内。 8-12 Hz. 8-12 Hz。 Could anyone help me? 有人可以帮我吗? I try to used: 我尝试使用:

xdft=fft(x); 
ixdft=ifft(xdft(a:b)), %where xdft(a:b) is |Y(f)| for freq 8-12 Hz.

But it doesn't want to work. 但是它不想工作。

You can set all the values of xdft to zero except those you want, ie, 您可以将xdft所有值都设置为零,但您想要的值除外,即,

xdft = fft(x);
xdft = xdft(1:ceil(length(xdft) / 2));
xdft(1:a) = 0;
xdft(b+1:end) = 0;
ixdft = ifft(xdft, 'symmetric');

The reason I have taken only half of the original FFT'd data is that your result will be symmetric about Fs / 2 (where Fs is the sample rate), and if you don't do the same thing to the frequencies either side of the centre, you will get a complex signal out. 我只获取原始FFT数据的一半的原因是,您的结果将相对于Fs / 2(其中Fs是采样率)对称,并且如果您对频率的任一侧都不做相同的事情中心,您将收到一个复杂的信号。 Instead of doing the same thing to both sides manually, I've just taken one side, modified it, and told ifft that it has to reconstruct the data for the full frequency range by appending a mirror image of what you pass it; 我没有手动对两边进行相同的操作,而是将其一侧修改了,并告诉ifft ,它必须通过附加通过的镜像来重建整个频率范围的数据。 this by done by calling it with the 'symmetric' option. 这可以通过使用'symmetric'选项调用来完成。

If you need to figure out what a and b should be for some frequency, you can first create a vector of the frequencies at which you've performed the FFT, then find those frequencies that are within your range, like so: 如果需要确定某个频率的ab ,可以首先创建执行FFT的频率的向量,然后找到在您范围内的那些频率,如下所示:

xdft = fft(x);
xdft = xdft(1:ceil(length(xdft) / 2));
f = linspace(0, Fs / 2, length(xdft));
keepInd = f >= 8 & f <= 12; % Keep frequencies between 8 and 12 Hz
xdft(~keepInd) = 0;

Note that I've actually omitted the use of the two variables a and b altogether in this example and opted for logical indexing, and that Fs is the sample rate. 请注意,在此示例中,我实际上完全省略了两个变量ab的使用,而是选择了逻辑索引,而Fs是采样率。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM