Effacer les filtres
Effacer les filtres

How to calculate Amplitude and phase out of FFT transform of the signal ?

10 vues (au cours des 30 derniers jours)
alex
alex le 10 Mar 2012
Hi All ! How are you people ? I have a question in matlab: I tried to write a code that finds an Amplitude and Phase_shift of the Periodic signal(cosine wave) BUT it doesn't give the correct answer(instead of Amplitude=10,i am getting answer Amplitude=5)!!! Could someone to see the code and to tell me what i'am doing the wrong way ?
%THE CODE function ask_portal_fft per=24;%number of periods w=2*pi*per;% points=1000; t=linspace(0,1,points); a=10;%the amplitude so the answer of Amplitude suppose to be 10 y=a*cos(w*t-1);%Phase shift suppose to be 1 %plot(y)%for debug %-------------
Y=fft(y); N=length(Y); Psd=Y.*conj(Y); mx=find(Psd==max(Psd),1); Amplitude=sqrt(Psd(mx)); Amplitude=Amplitude/N;%=4.99,why not 10 ?
Phase=angle(Y(mx));%suppose to be 1 end

Réponse acceptée

Dr. Seis
Dr. Seis le 11 Mar 2012
This reminds me of the same issure here:
Basically your maximum amplitude should be at 24Hz, right? Here is the Fourier transform of your signal at 24Hz.
>> ff = 24;
>> G_ff = quad(@(t)10*cos(2*pi*ff*t-1).*exp(-1i*2*pi*ff*t),0,1)
G_ff =
2.7015 - 4.2074i
>> sqrt(G_ff*conj(G_ff))
ans =
5
It's 5 !!!
  2 commentaires
Dr. Seis
Dr. Seis le 11 Mar 2012
However, to scale the FFT you should be using the time increment (dt = 1/Fs) instead of the number of points (N). See my reasons here:
http://www.mathworks.com/matlabcentral/answers/15770-scaling-the-fft-and-the-ifft
The result Y = fft(y)/N comes out very similar to Y = fft(y)*dt, where dt is equal to 0.001001 in your example, by the fact that 1/N is almost equal to dt.
alex
alex le 31 Août 2012
Thank you for answer I had to process the data that taken from the movement sensors in the mice cage.The expected Period of their activity was 24 hours. That's the reason I asked you whether the my algorithm was correct.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by