代码:
A=keshiyin_moni; %这里的A=后面写文件的名字
FS=50;T=1/FS; % FS是采样率
L=length(A);
t=(0:L-1)*T;
figure(1);
plot(t,A);
figure(6);
NFFT = 2^nextpow2(L); % Next power of 2 from length of y
Y = fft(A,NFFT)/L;
f = FS/2*linspace(0,1,NFFT/2);
plot(f,2*abs(Y(1:NFFT/2)));