# phase of FFT

Started by May 7, 2012
```Hey all,

I'm new here.
Currently I'm struggling with the phase of FFT. I read that the phase of
FFT is relative to the start of the time domian signal. In my measurement I
recorded a signal which is a sinus sweeping from 100hz to 3000hz. after FFT
i obtained a phase spectrum within the specified frequency range. what I
dont get is how do we get for each frequency component a phase if the phase
of fft related only to the start time. How does the phase is transformed
from the time domain to the frequency domain.. I would really appreciate if
some of you guys provide me an explaination regarding to this.

cheers,
Eva

```
```On Mon, 07 May 2012 07:09:56 -0500, evawoo wrote:

> Hey all,
>
> I'm new here.
> Currently I'm struggling with the phase of FFT. I read that the phase of
> FFT is relative to the start of the time domian signal. In my
> measurement I recorded a signal which is a sinus sweeping from 100hz to
> 3000hz. after FFT i obtained a phase spectrum within the specified
> frequency range. what I dont get is how do we get for each frequency
> component a phase if the phase of fft related only to the start time.
> How does the phase is transformed from the time domain to the frequency
> domain.. I would really appreciate if some of you guys provide me an
> explaination regarding to this.

Every property of the discrete Fourier transform* can be deduced by it's
mathematical definition -- it may be helpful to review that.

The phase of the DFT isn't _just_ related to the start time of the signal
-- it's the inherent phase properties of the signal being measured _and_
the start time.  As a simple example, if your signal is cos(w*t), then
consider what happens when the sample times are at t_n = n * T_s vs. n *
T_s + t_f -- the offset time changes the apparent phase of the sampled
signal, right?  And the DFT dutifully measures that phase.

What do you expect to learn from the phase spectrum?

* The _fast_ Fourier transform is just a great algorithmic trick to make
the DFT happen in less time.

--
Tim Wescott
Control system and signal processing consulting
www.wescottdesign.com
```
```On Mon, 07 May 2012 10:31:15 -0500, Tim Wescott

>On Mon, 07 May 2012 07:09:56 -0500, evawoo wrote:
>
>> Hey all,
>>
>> I'm new here.
>> Currently I'm struggling with the phase of FFT. I read that the phase of
>> FFT is relative to the start of the time domian signal. In my
>> measurement I recorded a signal which is a sinus sweeping from 100hz to
>> 3000hz. after FFT i obtained a phase spectrum within the specified
>> frequency range. what I dont get is how do we get for each frequency
>> component a phase if the phase of fft related only to the start time.
>> How does the phase is transformed from the time domain to the frequency
>> domain.. I would really appreciate if some of you guys provide me an
>> explaination regarding to this.
>
>Every property of the discrete Fourier transform* can be deduced by it's
>mathematical definition -- it may be helpful to review that.
>
>The phase of the DFT isn't _just_ related to the start time of the signal
>-- it's the inherent phase properties of the signal being measured _and_
>the start time.  As a simple example, if your signal is cos(w*t), then
>consider what happens when the sample times are at t_n = n * T_s vs. n *
>T_s + t_f -- the offset time changes the apparent phase of the sampled
>signal, right?  And the DFT dutifully measures that phase.

I think more correctly the phases in the DFT output will be relative
to the start of the DFT window, which may or may not be the same as
the start time of the time domain signal.

>What do you expect to learn from the phase spectrum?
>
>* The _fast_ Fourier transform is just a great algorithmic trick to make
>the DFT happen in less time.
>
>
>--
>Tim Wescott
>Control system and signal processing consulting
>www.wescottdesign.com

Eric Jacobsen
Anchor Hill Communications
www.anchorhill.com
```
```>On Mon, 07 May 2012 07:09:56 -0500, evawoo wrote:
>
>> Hey all,
>>
>> I'm new here.
>> Currently I'm struggling with the phase of FFT. I read that the phase
of
>> FFT is relative to the start of the time domian signal. In my
>> measurement I recorded a signal which is a sinus sweeping from 100hz to
>> 3000hz. after FFT i obtained a phase spectrum within the specified
>> frequency range. what I dont get is how do we get for each frequency
>> component a phase if the phase of fft related only to the start time.
>> How does the phase is transformed from the time domain to the frequency
>> domain.. I would really appreciate if some of you guys provide me an
>> explaination regarding to this.
>
>Every property of the discrete Fourier transform* can be deduced by it's
>mathematical definition -- it may be helpful to review that.
>
>The phase of the DFT isn't _just_ related to the start time of the signal

>-- it's the inherent phase properties of the signal being measured _and_
>the start time.  As a simple example, if your signal is cos(w*t), then
>consider what happens when the sample times are at t_n = n * T_s vs. n *
>T_s + t_f -- the offset time changes the apparent phase of the sampled
>signal, right?  And the DFT dutifully measures that phase.
>
>What do you expect to learn from the phase spectrum?

Hi Tim ,

Thanks a lot for the great reply. That was really impressive. Actually I
was trying to interpret a phase spectrum plot from my measurement results.

I characterized an acoustic system by taking a complex TF (transfer
function&#65306;frequency response of an output/frequency response of an input)
of the system. the amplitude of the TF gives peaks at resonance
frequencies, which is clear. because the resonance frequency is frequencies
at which the system has the strongest osillation.

In the phase vs. frequency plot, I observed that the phase reaches to a
minimum degree(-180deg) at resonance frequency, and then directly jump to a
maximum degree(180deg)at the same frequency. So it seems that I could
obtain the resonance frequency by the phase shift too. But I cant explain
the physical mechanism behind this. It would help me a lot if you could
explain that to me, thanks

best,
Eva
>
>* The _fast_ Fourier transform is just a great algorithmic trick to make
>the DFT happen in less time.
>
>
>--
>Tim Wescott
>Control system and signal processing consulting
>www.wescottdesign.com
>

```
```>On Mon, 07 May 2012 07:09:56 -0500, evawoo wrote:
>
>> Hey all,
>>
>> I'm new here.
>> Currently I'm struggling with the phase of FFT. I read that the phase
of
>> FFT is relative to the start of the time domian signal. In my
>> measurement I recorded a signal which is a sinus sweeping from 100hz to
>> 3000hz. after FFT i obtained a phase spectrum within the specified
>> frequency range. what I dont get is how do we get for each frequency
>> component a phase if the phase of fft related only to the start time.
>> How does the phase is transformed from the time domain to the frequency
>> domain.. I would really appreciate if some of you guys provide me an
>> explaination regarding to this.
>
>Every property of the discrete Fourier transform* can be deduced by it's
>mathematical definition -- it may be helpful to review that.
>
>The phase of the DFT isn't _just_ related to the start time of the signal

>-- it's the inherent phase properties of the signal being measured _and_
>the start time.  As a simple example, if your signal is cos(w*t), then
>consider what happens when the sample times are at t_n = n * T_s vs. n *
>T_s + t_f -- the offset time changes the apparent phase of the sampled
>signal, right?  And the DFT dutifully measures that phase.
>
>What do you expect to learn from the phase spectrum?
>

Hi Tim,
Thanks a lot for the great reply. That was really impressive.

Actually I got stuck when trying to intepret a phase spectrum plot from an
acoustic measurement.

I characterized an acoustic system by taking a complex TF (transfer
function&#65306;frequency response of an output/frequency response of an input)
of the system. the amplitude of the TF gives peaks at resonance
frequencies, which is clear. because the resonance frequency is frequencies
at which the system has the strongest osillation.

In the phase vs. frequency plot, I observed that the phase reaches to a
minumum degree(-180) at the resonance frequency, and then directly jump to
a maximum(180deg) at the same frequency. So it seems that I could obtain
the resonance frequency by the phase shift too. But I cant explain the
physical mechanism behind this. It would help me a lot if you could explain
that to me, thanks

best,
Eva

>* The _fast_ Fourier transform is just a great algorithmic trick to make
>the DFT happen in less time.
>
>
>--
>Tim Wescott
>Control system and signal processing consulting
>www.wescottdesign.com
>
```
```>Hey all,
>
>I'm new here.
>Currently I'm struggling with the phase of FFT. I read that the phase of
>FFT is relative to the start of the time domian signal. In my measurement
I
>recorded a signal which is a sinus sweeping from 100hz to 3000hz. after
FFT
>i obtained a phase spectrum within the specified frequency range. what I
>dont get is how do we get for each frequency component a phase if the
phase
>of fft related only to the start time. How does the phase is transformed
>from the time domain to the frequency domain.. I would really appreciate
if
>some of you guys provide me an explaination regarding to this.
>
>cheers,
>Eva
>

I think it would be benefical for you to generate the DFT matrix...Call
that matrix F (complex valued)... and look at your input data is some
vector x.

Then the DFT of your input signal is some output lets call it Y.

Y = F*x.  (matrix multiply of course).

To figure out whats happening, you may want to plot each column of F, both
the real and imaginary part. Those columns are your basis functions.

Each complex bin of the DFT is the projection of those basis functions on
your signal... The phase just signifying whether your singal x is more odd
or more even at this basis.

```
```evawoo <evawoo09@n_o_s_p_a_m.gmail.com> wrote:

(snip, someone wrote)
>>The phase of the DFT isn't _just_ related to the start time of the signal

(snip)
>>What do you expect to learn from the phase spectrum?

> Thanks a lot for the great reply. That was really impressive.

> Actually I got stuck when trying to intepret a phase spectrum
> plot from an acoustic measurement.

> I characterized an acoustic system by taking a complex TF (transfer
> function frequency response of an output/frequency response of an
> input) of the system. the amplitude of the TF gives peaks at resonance
> frequencies, which is clear. because the resonance frequency is
> frequencies at which the system has the strongest osillation.

As someone mentioned, you have to be a little careful using the FFT.

For a transfer function, you might expect a continuous spectrum
from -infinity to infinity, the transform of the time domain signal
for all time. If you are careful, you can get close with the FFT,
either with a periodic signal, or one that goes close enough to zero
on both ends.

> In the phase vs. frequency plot, I observed that the phase
> reaches to a minumum degree(-180) at the resonance frequency,
> and then directly jump to a maximum(180deg) at the same frequency.
> So it seems that I could obtain the resonance frequency by the
> phase shift too. But I cant explain the physical mechanism
> behind this. It would help me a lot if you could explain that to me,
> thanks

The old favorite system for studying resonance is a mass and spring.
Add a little friction, sometimes air resistance, or losses in the
spring itself is enough.

That should be pretty close for acoustics, but in the DSP world
people might be more used to RLC (resistor, inductor, capacitor)
circuits.

(Stories are that in the early days of electronics, people used
the mechanical (mass and spring) analogy to understand resonant
circuits. Now, it is more usual to use the resonant circuit
analogy to understand the mechanical system.)

If you look at: http://en.wikipedia.org/wiki/Resonance#Theory

there is a nice resonant curve, also showing the phase.
Now, this is an intensity (amplitude squared) graph, and, not
so obvoiusly, the phase goes +/- 90 degrees (0.25 cycle), instead
of the +/- 180 degrees that you expect.

If you start with a mass and spring, moving the top of the spring
(mass on the bottom) slowly up and down, (far below resonance) the
mass will follow your motion. As you increase the frequency, and
approach resonance, the mass motion will be delayed. At resonance,
interestingly, as you note 180 degree phase shift, the mass will
be moving in the opposite direction from the driving force

Derivation of the equations of motion for the mass/spring
(but no damping) are:

http://en.wikipedia.org/wiki/Simple_harmonic_oscillator

Hope this helps. Ask more if you want.

-- glen
```
```On Mon, 07 May 2012 13:55:07 -0500, evawoo wrote:

>>On Mon, 07 May 2012 07:09:56 -0500, evawoo wrote:
>>
>>> Hey all,
>>>
>>> I'm new here.
>>> Currently I'm struggling with the phase of FFT. I read that the phase
> of
>>> FFT is relative to the start of the time domian signal. In my
>>> measurement I recorded a signal which is a sinus sweeping from 100hz
>>> to 3000hz. after FFT i obtained a phase spectrum within the specified
>>> frequency range. what I dont get is how do we get for each frequency
>>> component a phase if the phase of fft related only to the start time.
>>> How does the phase is transformed from the time domain to the
>>> frequency domain.. I would really appreciate if some of you guys
>>> provide me an explaination regarding to this.
>>
>>Every property of the discrete Fourier transform* can be deduced by it's
>>mathematical definition -- it may be helpful to review that.
>>
>>The phase of the DFT isn't _just_ related to the start time of the
>>signal
>
>>-- it's the inherent phase properties of the signal being measured _and_
>>the start time.  As a simple example, if your signal is cos(w*t), then
>>consider what happens when the sample times are at t_n = n * T_s vs. n *
>>T_s + t_f -- the offset time changes the apparent phase of the sampled
>>signal, right?  And the DFT dutifully measures that phase.
>>
>>What do you expect to learn from the phase spectrum?
>>
>>
> Hi Tim,
> Thanks a lot for the great reply. That was really impressive.
>
> Actually I got stuck when trying to intepret a phase spectrum plot from
> an acoustic measurement.
>
> I characterized an acoustic system by taking a complex TF (transfer
> function&#65306;frequency response of an output/frequency response of an input)
> of the system. the amplitude of the TF gives peaks at resonance
> frequencies, which is clear. because the resonance frequency is
> frequencies at which the system has the strongest osillation.
>
> In the phase vs. frequency plot,

If you're doing this for transfer function extraction, you should
determine the transfer function by dividing your system output signal
(what you measure with the microphones) by your system input signal (what
you used to drive the speakers).

In that case, your time reference is the same (at least it is if you
properly account for all your delays), so the phase of your transfer
function is automatically correct -- or at least it's automatically not
screwed up by what you've done.

> I observed that the phase reaches to a
> minumum degree(-180) at the resonance frequency, and then directly jump
> to a maximum(180deg) at the same frequency. So it seems that I could
> obtain the resonance frequency by the phase shift too. But I cant
> explain the physical mechanism behind this. It would help me a lot if
> you could explain that to me, thanks

You are missing the fact that phase is effectively mapped in a circle:
-179.9999 degrees is not almost 360 degrees away from +179.9999 --
rather, it is just next door, 0.0002 degrees away.  Or, at least in the
case you cite (keeping track of phases can be fun, irritating, mind-
bending, or some combination of the three).

The fact that you see the phase go through 180 (or -180) degrees at a
resonance peak is happenstance: if you take a filter that has a resonance
with phase at 180 degrees and cascade it with a filter that has a phase
shift of 90 degrees, then you will find that at your resonance peak the
phase is 90 degrees.

--
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
Why am I not happy that they have found common ground?

Tim Wescott, Communications, Control, Circuits & Software
http://www.wescottdesign.com
```
```"evawoo" <evawoo09@n_o_s_p_a_m.gmail.com> writes:

> Hey all,
>
> I'm new here.
> Currently I'm struggling with the phase of FFT. I read that the phase of
> FFT is relative to the start of the time domian signal. In my measurement I
> recorded a signal which is a sinus sweeping from 100hz to 3000hz. after FFT
> i obtained a phase spectrum within the specified frequency range. what I
> dont get is how do we get for each frequency component a phase if the phase
> of fft related only to the start time. How does the phase is transformed
> from the time domain to the frequency domain.. I would really appreciate if
> some of you guys provide me an explaination regarding to this.

Eva,

I have perhaps a slightly different view of the FFT magnitude and
phases; I hope it is a simple view (as simple as possible?):

The N complex values (magnitude/phase, in polar form) which result
from an N-point FFT are the N Fourier coefficients describing the
infinite, periodic, signal which would result when the given N input
samples x[n], n = 0, 1, ..., N-1 are extended as a periodic signal
in which x[n] = x[n + M*N].

And so the "phase" is simply that required for the series to represent
the signal.

Thus "phase" is not really the phase you may be looking for at all. For
example, think of the case of sampling a sine wave in which the N
samples span only a portion of the sine wave period (at some given
sample rate). Then that phase really has nothing to do with the sine
wave phase theta (sin(w * t + omega)) but instead deals with the phase
required to represent the N-point periodic sequence you picked from the
original signal.

How does one approximate the "true" frequency domain of a non-periodic
input signal? Left as an exercise...
--
Randy Yates
DSP/Firmware Engineer
919-577-9882 (H)
919-720-2916 (C)
```
```On 08.05.2012 05:40, Randy Yates wrote:
> "evawoo"<evawoo09@n_o_s_p_a_m.gmail.com>  writes:
>
>> Hey all,
>>
>> I'm new here.
>> Currently I'm struggling with the phase of FFT. I read that the phase of
>> FFT is relative to the start of the time domian signal. In my measurement I
>> recorded a signal which is a sinus sweeping from 100hz to 3000hz. after FFT
>> i obtained a phase spectrum within the specified frequency range. what I
>> dont get is how do we get for each frequency component a phase if the phase
>> of fft related only to the start time. How does the phase is transformed
>> from the time domain to the frequency domain.. I would really appreciate if
>> some of you guys provide me an explaination regarding to this.
>
> Eva,
>
> I have perhaps a slightly different view of the FFT magnitude and
> phases; I hope it is a simple view (as simple as possible?):
>
>    The N complex values (magnitude/phase, in polar form) which result
>    from an N-point FFT are the N Fourier coefficients describing the
>    infinite, periodic, signal which would result when the given N input
>    samples x[n], n = 0, 1, ..., N-1 are extended as a periodic signal
>    in which x[n] = x[n + M*N].
>
> And so the "phase" is simply that required for the series to represent
> the signal.
>
> Thus "phase" is not really the phase you may be looking for at all. For
> example, think of the case of sampling a sine wave in which the N
> samples span only a portion of the sine wave period (at some given
> sample rate). Then that phase really has nothing to do with the sine
> wave phase theta (sin(w * t + omega)) but instead deals with the phase
> required to represent the N-point periodic sequence you picked from the
> original signal.
>
> How does one approximate the "true" frequency domain of a non-periodic
> input signal? Left as an exercise...

worded differently, the FFT result gives you a "recipe" how to construct
your original signal from sine waves. The FFT result just tells you what
amplitude and phase to use for each sine component.

```