t = (1:800)/200; S = 0.8*sin(2*pi*60*t) + 2.3*sin(2*pi*25*t); myper(S, 200); figure load gong.mat; myper(y, Fs) %Dominat freq around 1000 and 1250 figure load handel.mat myper(y(1:73110), Fs) %Dominate freq around 600 and 1200 function z = myper(x,samp) N = length(x); TT = N/samp; %total elapsed time X = fft(x); P2 = (1/N^2)*abs(X).^2; %rescale amplitude P1 = P2(1:N/2+1); P1(2:end-1) = 2*P1(2:end-1); f = (0:N/2)/TT; plot(f,P1) title('Periodogram of X(t)') xlabel('freq (Hz)') ylabel('|P1(f)|') end