Advertisement
Guest User

Untitled

a guest
Mar 18th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.40 KB | None | 0 0
  1. f=1000;
  2. Fs=48000; %48kHz
  3. L=2000; %wartosc do testowania
  4. T=1/Fs; %odleglosc miedzy probkami
  5.  
  6. t=[1:L-1]*T; %wektor kolejnych chwil czasowych
  7. X=1*sin(2*pi*f*t);
  8. Y=fft(X);
  9. P2 = abs(Y/L);
  10. P1 = P2(1:L/2+1);
  11. P1(2:end-1) = 2*P1(2:end-1);
  12. f = Fs*(0:(L/2))/L;
  13. title('Single-Sided Amplitude Spectrum of X(t)')
  14. xlabel('f (Hz)')
  15. ylabel('|P1(f)|')
  16. subplot(2,1,1);
  17. plot(X)
  18. subplot(2,1,2);
  19. plot(f,P1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement