I've red through the matlabcentral discussion on fftshift
and ifftshift
but I don't understand completely what's the right thing to do for me. A bit more helpful for one aspect is this answer on stackoverflow.
I have an array A
with (equally-spaced) angular frequencies in the first column and the corresponding intensities in the second column. It has an arbitrary length (can be odd or even). It does not start with zero frequency, but essentially, I am interested in a time-shift tau
of an interferometer which causes a spectral modulation cos(omega*tau+phi)
(where omega
is the angular frequency and phi
a phase). I am interested in the phase, too. At least in the relative phase compared to other measurements.
Now, my questions are the following
- Do I have to add values down to zero frequency?
- a) If so, where would I get them from? I can't simply insert zeros. To my understanding, I can just ignore it (basically shift the frequencies by the minimum frequency value in the data) and then get the phase wrong.
- b) If I perform this shift (i.e. if I just don't care), and do this for multiple measurements, but each time by the same amount (i.e. all start at the same frequency), will the relative phase information keep unchanged? Intuitively, I think yes.
- What about negative frequencies that would actually appear in a Fourier transform? How do I deal with the fact that I'm lacking those?
A
constists of only real values - if I want the result with zero time delay centered, which of the following should I perform?
- I would choose
fftshift(ifft(ifftshift(A(:,2))))
as suggested by the first posting ifft(ifftshift(A(:,2)))
(as far as I understood this gives me a shifted output)ifft(A(:,2))
(this should give me a shifted output with the wrong phase)- even something else?
- I would choose
- As I am using the angular frequency, do I need to multiply the values in my time delay vector by
2*pi
? I would construct it the following way:(-length(A(:,1)):length(A(:,1))-1)/(2*length(A(:,1))*(A(2,1)-A(1,1)))
or simpler(-L:L-1)/(2*L*D)
whereL=length(A(:,1))
is the length of my frequency array andD=A(2,1)-A(1,1)
is the frequency resolution
Sorry that there are so many questions but I am really confused and the matlab documentation is no real help in this case.