在致电fft或ifft之前,我需要先致电fftshift吗?

编程入门 行业动态 更新时间:2024-10-08 10:32:38
本文介绍了在致电fft或ifft之前,我需要先致电fftshift吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

在David Voelz撰写的《计算傅里叶光学,Matlab教程》一书中,写道,在调用fft或k之前需要先调用fftshift,但是在fftshift的MATLAB文档中只是写了这个命令

In the book "Computational Fourier Optics, A Matlab Tutorial" by David Voelz, it is written that a call to fftshift is needed before a call to fft or k, but in the MATLAB documentation of fftshift it's only written that this command

通过将零频率分量移动到数组的中心来重新排列fft,fft2和fftn的输出.

在文档中没有提到在调用fft之前应先调用此命令,并且我看到了一些示例,这些示例在不事先调用fftshift的情况下调用fft.

There is no mention in documentation that this command should be called before the call to fft, and I saw some examples that call fft without a call to fftshift beforehand.

我的问题是:在调用fft或ifft之前是否需要调用fftshift?

My question is: Whether or not fftshift needed to be called before a call to fft or ifft?

如果在调用fft之前不需要调用fftshift,仅在调用fft之后才需要调用fftshift,那么我们何时应该(如果有的话)使用与以下命令相关的命令ifftshift:数据集的fft的计算?

If fftshift doesn't need to be called before a call to fft, and only after a call to fft, then when should we use (if at all) the command ifftshift with relation to a calculation of the fft of a data set?

推荐答案

为了节省计算时间,matlab fft只计算频谱的一半(如果采样数为奇数,则为正频率和零频率).

The matlab fft only computes half of the frequency spectrum (positive frequencies and the null frequency if your number of samples is odd) in order to save computation time.

然后,将频谱的后半部分(即前半部分的复共轭)添加到此向量的末尾.

Then, the second half of the frequency spectrum (which is the complex conjugate of the first half) is just added at the end of this vector.

所以在fft之后您会得到:

0 1 2 3 ...(频率箱> 0)... Fs/2 -Fs/2 ...(频率箱< 0)... -3 -2 -1

0 1 2 3... (freq bins > 0) ... Fs/2 -Fs/2... (freq bins < 0) ... -3 -2 -1

Fs是频率采样.

现在,fftshift所做的只是在向量的开头移动负频点(频谱的第二部分),以便您可以显示从-Fs/2到+ Fs/2.

Now, what fftshift does is just shifting the negative frequency bins (2nd part of the frequency spectrum) at the beginning of your vector so that you can display a nice frequency spectrum starting at -Fs/2 and ending at +Fs/2.

因此,要回答您的问题,不需要在调用fft或ifft之前使用fftshift.但是,如果在引导程序上使用了fftshift,则应通过应用ifftshift或fftshift(我认为两个调用都等效)来撤消它.

So, to answer your question, no you don't need to use fftshift after of before a call to fft or ifft. But if you used a fftshift on your vector, you should undo it by applying an ifftshift or fftshift (I think both calls are equivalent).

更多推荐

在致电fft或ifft之前,我需要先致电fftshift吗?

本文发布于:2023-11-12 02:08:40,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1580194.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:fft   ifft   fftshift

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!