finding out phase shift in time domain from FFT result

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?

 Akzeptierte Antwort

Wayne King
Wayne King am 3 Feb. 2014
Bearbeitet: Wayne King am 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 Kommentare

Hallo Wayne, Thank you.. seems prety straight forward and it works.. I forgot to delete the negative component, it wasnt working and i thought, fine.. let me find out the phase. :) Works perfect now
so can you accept my answer if I have helped you?
Hey Wayne, Can you tell me why did you put 101 as your frequency instead of 100? This does not work for sinusoidal...

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Shivaputra Narke
Shivaputra Narke am 3 Feb. 2014

0 Stimmen

Search 'fft phase' in Matlab help menu.
Zohaib
Zohaib am 29 Aug. 2014

0 Stimmen

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

Gefragt:

am 3 Feb. 2014

Kommentiert:

am 16 Okt. 2015

Community Treasure Hunt

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

Start Hunting!

Translated by