Wrong amplitude values after the FFT
이전 댓글 표시
Hi all, At the plot of the code that written below, i should see amplitude between values of 75 to 200 uV but there is something strange in my plot, can you help me and advise, what wrong with my code and how can i correct that ?
Thank you all
Here is the code :
clear all;
close all;
Fs = 200
t= 0:1/Fs:180
y_in=zeros (1, length(t));
for i = 1:18
F = randi ([4 7], 1);% frequency
A = randi ([75 200],1);% amplitude A=75~200 uV.
y_tmp =A*sin (2*pi*F*t);
y_in=y_in+ y_tmp;
end;
L=length (y_in);
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y_new = fft(y_in,NFFT)/L;
f_new = Fs/2*linspace(0,1,NFFT/2+1);
figure(1)
plot(f_new,2*abs(Y_new(1:NFFT/2+1))) ;
title('Single-Sided Amplitude Spectrum of y_in(t)')
xlabel('Frequency (Hz)')
ylabel('|y_in(f)|')
채택된 답변
추가 답변 (1개)
카테고리
도움말 센터 및 File Exchange에서 App Building에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!