Advertisement
Guest User

Untitled

a guest
Dec 8th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. N = 64
  2. n = linspace(1, N, N)
  3. k = 1
  4. h = zeros(N)
  5. h[1] = 1
  6. y = sin(2 * pi * n/N)
  7.  
  8.  
  9.  
  10. Si = []
  11. Si.append(0.25*h[1])
  12. Si.append(0.5*h[1]+0.25*h[2])
  13. for elem in range(3,len(y)):
  14. Si.append(0.25*h[elem-2] + 0.5*h[elem-1] + 0.25*h[elem])
  15.  
  16. Ss = []
  17. Ss.append(0.25*y[1])
  18. Ss.append(0.5*y[1]+0.25*y[2])
  19. for elem in range(3,len(y)):
  20. Ss.append(0.25*y[elem-2] + 0.5*y[elem-1] + 0.25*y[elem])
  21.  
  22. subplot(2, 2, 1)
  23. stem(n, h)
  24. xlim(0, 80)
  25. ylim(0, 1)
  26. xlabel('Numer próbki')
  27. ylabel('Amplituda')
  28. title('Pobudzenie - impuls')
  29.  
  30. subplot(2, 2, 2)
  31. stem(n, y)
  32. xlabel('Numer próbki')
  33. ylabel('Amplituda')
  34. title('Pobudzenie - sygnał sinusoidalny')
  35.  
  36. subplot(2, 2, 3)
  37. stem(Si)
  38. xlabel('Numer próbki')
  39. ylabel('Amplituda')
  40. title('Odpowiedź impulsowa')
  41.  
  42. subplot(2, 2, 4)
  43. stem(Ss)
  44. xlabel('Numer próbki')
  45. ylabel('Amplituda')
  46. title('Odpowiedź na pobudzenie sinusoidalne')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement