finding out phase shift in time domain from FFT result

138 views (last 30 days)
Hallo, I have a signal represented by a sum of sinusoids (each having a different frequency and different phase shifts in the time domain). I do an FFT in matlab and get the amplitude spectrum of the wave. But from the phase spectrum i am not able to correlate the phase angles. (angle(signal) gives a different angle from what I expect.. for example if my 3rd harmonic sinus is 50 degress phase shifted, i get something irrelevant like 90 degress) My application would be, I have a random signal and I need to remove only one frequency component from the signal. If I don't have the time-phase shift of that frequency component, then I cant remove it from the signal. How do I get the phase angle from FFT?

Accepted Answer

Wayne King
Wayne King on 3 Feb 2014
Edited: Wayne King on 3 Feb 2014
You can get the phase from the output of fft()
Fs = 1000;
t = 0:1/Fs:1-1/Fs;
x = cos(2*pi*100*t-pi/4)+cos(2*pi*200*t-pi/2);
xdft = fft(x);
angle([xdft(101) xdft(201)])
but you have to keep in mind that:
1.) Phase is only defined modulo 2*pi
2.) Additive noise (if it is white) occurs at all frequencies so it will affect the phase.
You can see from the example above, the phase is correctly identified at 100 and 200 Hz.
Also, I don't understand your statement:
"I have a random signal and I need to remove only one frequency component from the signal. If I don't have the time-phase shift of that frequency component, then I cant remove it from the signal. How do I get the phase angle from FFT?"
If you really are just removing one sinusoidal component, why do you need the phase, you just need to know the DFT bin of the "positive" and "negative" frequency component.
Remove 200 Hz.
N = length(xdft);
conjbin = N-201+2;
ydft = xdft;
ydft([201 conjbin]) = 0;
y = ifft(ydft);
plot(y) % 200 Hz is removed
  3 Comments
Wayne King
Wayne King on 3 Feb 2014
so can you accept my answer if I have helped you?
Shrikant
Shrikant on 16 Oct 2015
Hey Wayne, Can you tell me why did you put 101 as your frequency instead of 100? This does not work for sinusoidal...

Sign in to comment.

More Answers (2)

Shivaputra Narke
Shivaputra Narke on 3 Feb 2014
Search 'fft phase' in Matlab help menu.

Zohaib
Zohaib on 29 Aug 2014
Hello Wayne king .. need your lil help bro
kidnly tell me how to calculate phase of a signal which is summation of four sinusoidal signal .. thr is phase shift due to mechanical vibrations .. i want to find phase shift of each component of signal .. kindly help ?

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!