How to obtain a FFT and satisfy a certain condition for it ?
4 次查看(过去 30 天)
显示 更早的评论
I have an array of points that gives me an interferogram like this:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155771/image.png)
I have to take the Fourier transform of this curve, precisely the FFT (Fast Fourier Transform). Before doing the FFT, I have to select a certain point X of the array in a way that the part before X is shifted to the end, like in the following figure (where X in this example is more or less 250):
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/155772/image.png)
In this way the length of the curve is kept constant. Now I have to do the FFT of this curve, which is obtained as a complex number: a+ib. From this FFT I can retrieve the magnitude as M=sqrt(a^2 + b^2) and the phase phi=atan(b/a). I'm interested in obtaining 'phi' and plotting it. If I choose a different point X of the array where I "cut" the interferogram, the quantity 'phi' will change also. The question is: Given an array of point (i.e. an interferogram, like the one in the first picture) how can I automatically find the point X that gives me a curve 'phi' which is as flat as possible (i.e. with the minimum slope) and as close as possible to zero? I'd like to find a way to obtain this point X authomatically when I load the trace, otherwise I have to try every time different points to satisfy the above condition. Thank you in advance.
2 个评论
Matt J
2014-1-29
编辑:Matt J
2014-1-29
Well, the solution is not unique. If, for example the second graph you've shown was the initial sequence of samples, then X=0 would be one solution because the frequency origin is a symmetry point, but X=length(signal)/2 is another solution because it is also a symmetry point (ignoring noise). You may need more criteria.
采纳的回答
Matt J
2014-1-30
编辑:Matt J
2014-1-30
As follows, perhaps. You would pre-compute A once and reuse it for different input signals of the same length, N.
N=length(signal);
A=exp(bsxfun(@times,(-2j*pi/N)*(0:N-1),(0:N-1).')); %pre-compute
S=fft(signal(:));
unflatness=sum(abs(imag(bsxfun(@times,S,A))));
[~,X]=min(unflatness),
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!