Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. N = 64 %Ilość próbek
  2. n = 0:1:N-1
  3. % Generowanie 64 próbek
  4. x1 = sin(2*pi*n/N)
  5. h = exp(-n/10)
  6. figure
  7. subplot(2,1,1)
  8. stem(n,x1,'-rs')
  9. xlabel('Numer próbki')
  10. ylabel('Amplituda')
  11. title('Pobudzenie - sygnał sinusoidalny')
  12. set(gca,'xtick')
  13. axis([-inf 120 -inf inf])
  14. subplot(2,1,2)
  15. stem(n,h,'-bs')
  16. xlabel('Numer próbki')
  17. ylabel('Amplituda')
  18. title('Odpowiedź impulsowa')
  19. set(gca,'xtick')
  20. axis([-inf 120 -inf inf])
  21.  
  22. % 64 punktowa dft sygnalu x1[n]
  23. dft1 = fft(x1,64)
  24. % 64 punktowa dft sygnalu h[n]
  25. dft2 = fft(h,64)
  26. % Iloczyn widm zespolonych:
  27. gk = dft1 .* dft2
  28. % Wyznaczyć IDFT iloczynu G(k):
  29. idft = ifft(gk)
  30. % Splot kołowy x1[n] oraz h[n]:
  31. splkol = cconv(x1, h, N)
  32.  
  33. % Porównanie wyników:
  34. figure
  35. subplot(2,1,1)
  36. plot(n,idft,'rs')
  37. xlabel('n')
  38. ylabel('Amplituda')
  39. title('IDFT iloczynu G(k)')
  40. set(gca,'xtick',[0:2:N],'ytick',[10:2:10])
  41. grid on
  42. subplot(2,1,2)
  43. plot(n,splkol,'bs')
  44. xlabel('n')
  45. ylabel('Amplituda')
  46. title('Splot kołowy x1[n] oraz h[n]')
  47. set(gca,'xtick',[0:2:N],'ytick',[10:2:10])
  48. grid on
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement