How can i determine phase in FFT?
이전 댓글 표시
Hi everyone, right now im trying to calculate signal phases using angle(x) from FFT Function im Matlab. Noted that i've coded the program like below :
%%Plotting Grafik
%create a time vector 't', containing integers from 1 to n(summary of data)
count= length(data);
Ts=mean(diff(times1));
Fs=1/Ts;
NFFT=2^nextpow2(count);
y=fft(data,NFFT)/count;
f=Fs/2*linspace(0,1,NFFT/2+1);
figure(2)
plot(f,2*abs(y(1:NFFT/2+1)));
grid on
title('Single-Sided Amplitude Spectrum of y(t)');
xlabel('Frequency(Hz)');
ylabel('|Y(f)|');
phase=angle(y);
But i'm not really sure with the phase function. Does anyone ever has the same experience?
Thanks before for your answer.
댓글 수: 6
Dan Bullard
2023년 3월 18일
I use this constantly in Excel, it's atan2(real, imaginary)
With this I proved Bullard Laws of Harmonics #5,
http://www.danbullard.com/dan/articles/why_law_5_is_so_important/why_law_5_is_so_important.html
Star Strider
2023년 3월 18일
Bruno Luong
2023년 3월 19일
편집: Bruno Luong
2023년 3월 19일
@Dan Bullard "it's atan2(real, imaginary)"
That formula is wrong the right formula is atan2(imaginary, real) and this is exactly what angle function does.
So reverse the two atan2 arguments, then you will fix the "backwardness" of your formula.
Dan Bullard
2023년 3월 19일
arctan2 is different in Fortran and Excel, forgive me, I use Excel and didn't know about the angle() function.
WH Wang
2023년 6월 28일
it's atan2(imaginary,real) in matlab, or using phase() function of matlab.
Star Strider
2023년 6월 28일
There is no phase function that I can find in the documentation, however there is the angle function that returns the phase angle (in radians) of a complex argument.
채택된 답변
추가 답변 (1개)
karinkan
2018년 6월 1일
0 개 추천
I am a bit confusing that the following two equations which one is correct? eq.1 y=fft(data,NFFT)/count; eq.2 y=fft(data,NFFT)/NFFT;
카테고리
도움말 센터 및 File Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
