%% this function plots the fft of and input x function showfft(data) figure ld=length(data); f=0:1/ld:1-1/ld; df=abs(fft(data)); df=df/max(df); semilogy(f,df) axis([0:1, 0.001 1.1]) xlabel('f/f_s'); ylabel('Spectrum of data')