The difference between the obtained result using fftshift when employing the ifft() function
3 次查看(过去 30 天)
显示 更早的评论
Hey,
I am trying to calculate the inverse fourier transform of a function using ifft(). I have noted some differences in the result with and without using the fftshift of the ifft result. I am trying to calculate the output pulse from a system and still not sure which of the answers are acceptable. I have attached the relevant code.
Without fftshift this is the answer for the output:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1360283/image.png)
where the pulses on the left and right are:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1360288/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1360293/image.png)
Now if I use the fftshift for the result of ifft function I see only one pulse in the middle (the small chunk on the right is gone):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1360298/image.png)
and if I zoom in I see:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1360303/image.png)
Now, I am wondering is there a differemce bewtween these two results? In other words does the small chunk I see on the right of the first figure matter? If I am looking for the output from my system which of these two answers are more reliable (with or without using fftshift)? Also, if I write a code for the inverse Fourier transform myself do I still see that small chunk?
I appreciate your comments.
0 个评论
采纳的回答
Walter Roberson
2023-4-18
移动:Walter Roberson
2023-4-18
In the original, on the right we see a large pulse, then left of that is a smaller pulse, and left of that is a pretty small pulse, and then (it looks like) nothing until the axis.
With the shifted version, the large pulse has three smaller pulses to the left of it.
The pulses to the right have not "disappeared": they have been moved to left of centre.
fftshift / ifftshift effectively just cut the plot in two and move the right side to be left of the other side.
x = linspace(0,1,100);
plot(x, 'displayname', 'original');
ix = fftshift(x);
hold on
plot(ix, 'displayname', 'shifted');
hold off
legend show
3 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Frequency Transformations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!