How to calculate Amplitude and phase out of FFT transform of the signal ?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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
0 Kommentare
Akzeptierte Antwort
Dr. Seis
am 11 Mär. 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 Kommentare
Dr. Seis
am 11 Mär. 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.
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!