# Signification of alternating signs of imaginary and real part of an FFT

Let me start by saying that this question is motivated by data analysis that I am doing. It's part of a much larger set of signal processing operations, but in order to keep the question contained I'll ask a general question and hope, someone will be able to help me:

Is there any physical or mathematical characteristic that is known for a signal (containing only the odd Harmonics) whose FFT-imaginary and FFT-real parts have alternating signs ? As a matter of fact, this alternation happens when I shifted my signal in the time domain. This signal is measured and contains many periods. As I don't know the phase shift between the excitation signal and the measured signal, I am not really sure where the correct signal begins because I don't have the real phase shift. So when I shifted the time signal with (3/4)*Number_of_bins_per_Period, I got a plausible time signal (that suits other operations I am doing on its basis). So I wanted to know if I can find the reason why this shift : (3/4)*Number_of_bins_per_Period, is the correct shift by analyzing its effect on the real and imaginary part of the signal. Before the shifting, the FFT of the signal has these real and imaginary part: EDIT Please note that I am not asking about the fourier Transformation or why I am getting this behavior. This is clear. As I said, the shift I am doing (3 *Tr/4) I did it intuitively and it gave me afterwards the results I was looking for. I was hoping to find the answer, as WHY exactly this shift is the right one. And I thought maybe the hint would be the alternating signs. So why should be the sogns of the real and imaginary part alternating so that my shift is right . Is this a sort of finger-printing for a specific physical phenomena ?

• This question is too broad. It's clearly an oscillation, and you know to what an oscillation transforms through the DFT, and you can easily calculate what a dampened oscillation transforms to, and you can just do the ifft and get a visualization, so what's your question? Please don't let us in the dark about what you've tried and seen, we're not going to write down everything this really minimal dataset could imply. – Marcus Müller Jun 22 '17 at 20:01
• i am not voting to close. i think this issue is directly related to what we call "Half-band filters". and is probably related to all of the issues we've discussed regarding MATLAB's fftshift() utility. – robert bristow-johnson Jun 22 '17 at 20:53
• thank you for your answer. But could you please elaborate it ? I would be really grateful! – Tassou Jun 22 '17 at 20:55
• The shift property of the DFT is covered in thousands of places. Look for Fourier Transform properties on Wikipedia. it's not surprising that a specific 3·¼ shift has the effect. I'll leave inserting $\frac342\pi$ into the argument of $f(x)=e^{jx}$ to you as an exercise – I think you might want to brush up your complex analysis and Fourier Transform basics. – Marcus Müller Jun 22 '17 at 21:34
• Marcus, this in not an answer for my question. – Tassou Jun 23 '17 at 10:55

This is exactly the expected result for a time delay: A delay in time is a linear phase in frequency; so you shifted the amount that would cause 180 degree phase shifts between your frequencies (Note that at your first frequency sample location you have a positive real and positive imaginary, which rotates to positive real and negative imaginary which is a -90° rotation, then follow the same process for your second frequency and you will see it is a +90° rotation; the phase change between the frequencies given is 180°). It is repeating at 180° due to the modulo property of phase, but you are really seeing the evidence of a linear increase in phase that is rotating past 180 degrees at each of your frequency samples where energy exists.

Consider a signal at given frequency going through a fixed length of cable; it will be delayed a certain amount in time, and given the frequency that time will relate to a certain phase shift between the signal at the input and output of that cable. Now consider a frequency that is doubled, the time delay is the same but there will be twice the phase shift between the signal at the input and output in this case. This is the result of the Fourier Transform of a delay, the magnitude is one but the phase in linearly increasing at a negative rate. So in your case we are seeing the resulting rotation of 180 degrees for the same distance between your frequencies tones (evidence of a linearly increasing phase).

If you plotted each frequency as a complex vector on an I-Q (real vs imaginary) diagram, as you change the delay of your signal in time, you will see the vector rotate accordingly with no change in magnitude. The higher frequencies will rotate proportionally faster.

Here is another view in case that was not clear describing the same effect and very specific to your case. The top plot shows sine-waves in time for a first and third harmonic, and the delay at a fixed time offset such that the first harmonic has shifted -90° and the third harmonic as expected has shifted three times as much or -270°. These last plots demonstrate your case exactly and shows the same thing on a complex plane which is consistent with your complex frequency outputs that have real and imaginary components. Note that I use the common notation I and Q for real and imaginary where "I" is "In Phase" and "Q" is "Quadrature Phase".

Here we see the same thing in that each frequency tone is a vector that rotates around the complex plane at a fixed rate; so the third harmonic is rotating three times as fast as the first harmonic (and the fifth is rotating five times as fast etc). After a given time delay, we see the diagram where the first harmonic has rotated 90° and the third has rotated 270°. To try to keep this clear, I first show the case where the first and third harmonic are in phase, starting at an angle of +45° (Such that I and Q are both positive as in your plots) and we see the exact condition where after a fixed delay the first harmonic has rotated -90° such that I is postive and Q is negative, while the third harmonic in that same time duration has I negative and Q positive. (-270° rotation.) If we instead have a starting condition identical to your plots, where the first harmonic has both I and Q positive, but the third harmonic is 180° out of phase such that both I and Q are negative, we end up with the diagram below. We see the same thing where the first harmonic shifts -90° and the third shifts -270° after a given time delay. This is exactly the result from your plots: The first harmonic goes from I+, Q+ to I+, Q-, while the third harmonic goes from I-,Q- to I+,Q-. • Dan, I thank you thousand times for your time and patience and this great explanation. However I think that you misunderstood 2 things: my initial signal, is the second plot. SO all the harmonics have a positive real part and a negative imaginary part. the signal has 198 Bins per period and a sampling Frequency of 5 MHz.The excitation frequency (so first harmonic because my signal is a magnetic induction) is 25252.52 Hz. When I concider s_period = s[49:49+198], so I start concidering a period at the bin 49 and not at 0, I get the first plot for real anf imaginary part. – Tassou Jun 23 '17 at 10:33
• The second point that I would like to precise is that I don't have the first harmonic, what you see on the plots starts at the third harmonic. The first one we have to filter out because of feeed-through reasons. Is your explanation still suits my case ? – Tassou Jun 23 '17 at 10:34
• Dan,the real motivation about my question is not really the complex transformation I get while shifting. the shift amount (in my case t0 = 3/4 *Tr) was made intuitively. Now I am searching for a rational explanation as WHY this shift IS the right shift. An I thought that maybe, the relation between the rel and imaginary part after the shift have a specific meaning that would help me to argument why the shift should be t 0 = 3*Tr/4 – Tassou Jun 23 '17 at 10:58
• @Tassou the explanation still applies, observe if you start from your second plot and go through the same rotations (-90° and -270°) for the first two frequencies shown (it does not matter if if your first harmonic is not present as all of the harmonics will exhibit this), you will end up with the result in your first plot. WHY this shift is the right shift is because you chose a delay that ends up being a 90° shift or odd-integer multiple of 90° (See my plot showing the two sine waves). Does that answer your question? – Dan Boschen Jun 23 '17 at 11:14
• Thank you million time Dan. I now understand this. Actually, there is no offset between them, I create the offset, so that I consider on a period. firstly the increasing branch of the excitation sinus and than the decaying one . So it HAS TO BE a 3/4*Tr shift, And introducing that shift in the frequency domain would yield : X_shift (2n+1) = jX_not_shifted(2n+1)*exp(jpi*n) and that gives the alternating signs and the interchange between Real and imaginary part after the shift. Thank you ! – Tassou Jun 23 '17 at 12:45

Note that applying a finite length FFT to a longer length arbitrary frequency sinusoid applies a rectangular window (e.g. cuts off the stuff before and after the finite FFT input vector) to that sinusoid. A rectangular window in the time domain is the same as convolution with a Sinc function in the frequency domain. Note that a Sinc function has alternating lobes (above and below zero). So if the frequency of a sinusoid is shifted off a bin center (e.g. is not integer periodic within the FFT width), the Sinc function's alternating lobes will be sampled by the FFT result, thus resulting in alternating signs in the real and imaginary components of the FFT result.

(For exactly integer periodic in aperture signals, the Sinc is sampled mostly at zero crossings, so becomes invisible in the FFT result.)

Rotating a signal in the time domain sample array (equivalent to shifting a sufficiently zero-padded signal in the time domain) results in twisting the phase of the complex FFT result vector, with the amount of twist in the frequency domain proportional to the amount of shift the time domain.

• Thank you! I think that this is the right path to the answer I am looking for. I will read about the sinc function and hope to be able to get back to you for eventual further questions? – Tassou Jun 23 '17 at 11:02
• Although statement of fact, I don't think this really answers the question (the first two paragraphs). Regardless of FFT length, you could start with a signal that really has odd harmonics all in phase (such as any square wave sampled such that the Sinc is at the zero crossings) and you will still see this behavior. The FFT length may have created his original signal in either of the cases shown but that wasn't the question. The third paragraph stands on its own as the answer. – Dan Boschen Jun 23 '17 at 11:23