How to calculate Amplitude and phase out of FFT transform of the signal ?
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Multirate Signal Processing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!