Advertisement
Stybyk

Untitled

Nov 12th, 2015
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. fs = 20;
  2. Ts = 1/fs
  3. L = 10- Ts;
  4. t = 0:Ts:L;
  5.  
  6.  
  7. f = zeros(1,200);
  8. f(1:100) = 2;
  9. f(101:200) = 5;
  10. signal = sin(2*pi*f.*t);
  11. N = length(signal);
  12.  
  13.  
  14. XRozsah = abs(fftshift(fft(signal)));
  15. BinOsa = [0 : N-1];
  16. N_2 = ceil(N/2);
  17. FOsa= (BinOsa-N_2)*fs/N;
  18. title("Graf")
  19. subplot(2,1,1)
  20.  
  21. plot(FOsa, XRozsah)
  22. xlabel('Frekvence(Hz)');
  23. ylabel('Rozsah');
  24. title('Dvoustranne frekvensni spektrum');
  25. axis tight
  26. subplot(2,1,2)
  27. plot(t,signal)
  28. xlabel('Cas');
  29. ylabel('Amplituda');
  30. title("Casova oblast")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement