Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. Fs = 800; % Częstotliwości próbkowania
  2. Ts = 1/Fs; % Czas próbkowania
  3. L = 48; % Liczba próbek
  4. t_d = (0:L-1)*Ts; % Oś czasu - wartości dyskretne
  5. t_c = linspace(t_d(1),t_d(end),100); % Oś czasu - wartości ciągłe
  6. A = 10; % Parametry sygnały - Amplituda
  7. f = 50; % Parametry sygnały - Częstotliwości
  8. Phi = 0; % Parametry sygnały - Przesunięcie fazowe
  9. y_d = A*sin(2*pi*f*t_d + Phi); % Sygnał - wartości osi Y
  10. % Wykres
  11. figure
  12. set(gcf,'DefaultLineLineWidth',2);
  13. set(gcf,'DefaultAxesFontSize',14);
  14. hold on;
  15. stem(t_d,y_d,'s')
  16. hold off
  17. grid on
  18. xlabel('Czas[s]')
  19. ylabel('Amplituda')
  20. legend('- d -')
  21. % DFT
  22. Y = fft(y_d);
  23. Y = abs(Y)/L;
  24. Y(2:end-1) = 2*Y(2:end-1);
  25. f = Fs*(0:(L))/L;
  26. % Wykres
  27. figure
  28. set(gcf,'DefaultLineLineWidth',1);
  29. set(gcf,'DefaultAxesFontSize',14);
  30. stem(f(1:L/2+1),Y(1:L/2+1),'s','LineWidth',2)
  31. grid on
  32. xlabel('f[Hz]')
  33. ylabel('Amplituda')
  34. legend('- d -')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement