How to obtain a FFT and satisfy a certain condition for it ?
2 ビュー (過去 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 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!