How to obtain a FFT and satisfy a certain condition for it ?
3 views (last 30 days)
Show older comments
I have an array of points that gives me an interferogram like this:
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):
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 Comments
Matt J
on 29 Jan 2014
Edited: Matt J
on 29 Jan 2014
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.
Accepted Answer
Matt J
on 30 Jan 2014
Edited: Matt J
on 30 Jan 2014
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 Comments
More Answers (0)
See Also
Categories
Find more on Fourier Analysis and Filtering in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!