Advertisement
albert828

Widmo amplitudowe

Nov 9th, 2017
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.49 KB | None | 0 0
  1. %Widmo amplitudowe syngalu w zakresie 0-fp
  2.  
  3. clear;
  4.  
  5. N = 400;
  6. fp = 1000;
  7. t = 0:1/fp:(N-1)/fp;
  8.  
  9. %Suma sinusow i szumow
  10.  
  11. x= 6*sin(2*pi*250*t) + 3*sin(2*pi*350*t) + 2*randn(1,N);
  12. subplot(2, 1, 1);
  13. plot(t, x);
  14. xlabel('czas[s]');
  15. ylabel('sygnal');
  16.  
  17. % Widmo
  18. Nf= 1024;
  19. v = fft (x, Nf);      % Widmo zespolone
  20. w = abs (v);            % Widmo amplitudowe
  21. f = linspace (0, fp, Nf); %generowanie osi czestotliwosci
  22. subplot(212);
  23. plot (f, w);
  24. xlabel('czestotliwosc [Hz]');
  25. ylabel('modul widma');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement