0
$\begingroup$

I was playing with a set of time history, trying to extract its phases corresponding to the each distinguishable dominant frequency.

Just look at the figures: I got one of the dominant frequency in Fig.1, but in Fig. 2 there are two different phases close to the dominant frequency (f=0.05). Here I am confused; I do not understand why there are two phases near the dominant frequency.

Edit: it seems when I increase the threshold of masking noises, the negative phase disappeared.

FFT amplitude spec Fig. 1

enter image description here Fig. 2

Appendix: the code I used for phase extraction

    %     figure;plot(f,P1);
%     xlabel 'Frequency (Hz)';xlim([0 2.5])
%     ylabel 'A' %ylabel 'degrees' %
%     grid

    Yb=fft(y);
    ly = length(Yb);
    fb = (0:ly-1)/ly*Fs;

%     X3=Yb;
%     threshold = max(abs(Yb))/2; %tolerance threshold
%     %X3(abs(Yb)<threshold) = 0; %maskout values that are below the threshold
%     phs = unwrap(angle(X3));
%     %phs = (angle(X3));
%     figure;plot(fb,phs*180/pi)
%     %figure;plot(fb,(mod(phs*180/pi,360)))
%     xlabel 'Frequency (Hz)';xlim([0 2.5])
%     ylabel 'Phase (degrees)' %ylabel 'degrees' %
%     grid

    X1=Yb;%store the FFT results in another array
    %detect noise (very small numbers (eps)) and ignore them
    [maxYb, maxin]=max((abs(Yb))/ly);
    threshold = max((abs(Yb)))/2; %tolerance threshold
    X1(abs(Yb)<threshold) = 0; %maskout values that are below the threshold
    phase=atan2(imag(X1),real(X1))*180/pi; %phase information

    %phase(sum(fb<=0.05))% need to adjust manually
    %fb(sum(fb<=0.05))   %need to adjust manually

%     figure;plot(fb,phase); %phase vs frequencies
%     %disp(['at ',num2str(),])
%     xlabel 'Frequency (Hz)';xlim([0 2.5])
%     ylabel 'Phase (degrees)' %ylabel 'degrees' %

    disp(['Amax=',num2str(maxYb)])
    fmax=fb(maxin);disp(['f for Amax=',num2str(fmax)])
    phsmax=phase(maxin);disp(['phs for Amax=',num2str(phsmax)])
    phs=phsmax;

    %inverse fft test
%     X1i=ifft(X1);
%     figure;     plot(t,X1i)
%     hold on;    plot(t, y)
$\endgroup$
2
$\begingroup$

If the dominant frequency is not exactly integer periodic in the FFT width, then most of that frequency peak's energy will be split between the two nearest FFT result bins (two different frequencies). The phase of your frequency peak might be slightly ahead or behind the phase of the slightly lower FFT frequency bin. If so, it will have the opposite phase relationship (slightly behind or ahead) of the the FFT frequency bin slightly on the higher or opposite side in frequency difference.

So it's not two different phases. It's two opposing phase relationships when your dominant frequency spectra is correlated against the two nearest frequency FFT basis vectors, that are both slightly different (and one integer period of the FFT length apart), but on opposite sides in frequency, and thus opposite in phase difference relationship to your dominant frequency peak.

Unless, of course, your dominant peak represents a signal that is exactly integer periodic in the FFT aperture, in which case only one FFT result bin (per harmonic) will be involved, and you won't see two phases (for any non-zero FFT result bins that are above the noise floor)

$\endgroup$
  • $\begingroup$ Thank you! Just to clarify, does ur "opposite phase" means anti-phase of two frequencies? $\endgroup$ – zlin Mar 29 '17 at 11:46
0
$\begingroup$

I used ifft to do inverse Fourier transform. I found that using only the phase corresponding maximum amplitude has a more accurate ifft result compared with using two phases.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.