Matt23

cw3z1

Nov 20th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.87 KB | None | 0 0
  1. fs = 8000;
  2. time = 5;
  3. t = 0 : 1 / fs : time - 1 / fs;
  4. y1 = randn(time * fs, 1);
  5. y1 = transpose(y1);
  6.  
  7. figure
  8. subplot(4, 2, 1)
  9. plot(t, y1)
  10. title('Szum gaussowski')
  11. xlabel('Czas [s]')
  12. ylabel('Amplituda')
  13.  
  14. z = moc(y1, 0.999);
  15. subplot(4, 2, 2)
  16. plot(t, z)
  17. axis([0 5 0 2])
  18. title('Szum gaussowski - obwiednia mocy, alfa=0.999')
  19. xlabel('Czas [s]')
  20. ylabel('Moc')
  21.  
  22. subplot(4, 2, 3)
  23. plot(t, sin(2 * pi * 1000 * t))
  24. title('Sygnał sinusoidalny o stałej częstotliwości')
  25. xlabel('Czas [s]')
  26. ylabel('Amplituda')
  27. axis([-inf inf -2 2])
  28.  
  29. z = moc(sin(2 * pi * 1000 * t), 0.999);
  30. subplot(4, 2, 4)
  31. plot(t, z)
  32. axis([0 5 0 1])
  33. title('Sygnał sinusoidalny o stałej częstotliwości - obwiednia mocy, alfa=0.999')
  34. xlabel('Czas [s]')
  35. ylabel('Moc')
  36.  
  37. subplot(4, 2, 5)
  38. y1 = chirp(t, 0, 5, 1000);
  39. plot(t, y1)
  40. title('Sygnał sinusoidalny o zmiennej częstotliwości')
  41. xlabel('Czas [s]')
  42. ylabel('Amplituda')
  43. axis([-inf inf -2 2])
  44.  
  45. z = moc(y1, 0.999);
  46. subplot(4, 2, 6)
  47. plot(t, z)
  48. axis([0 5 0 1])
  49. title('Sygnał sinusoidalny o zmiennej częstotliwości - obwiednia mocy, alfa=0.999')
  50. xlabel('Czas [s]')
  51. ylabel('Moc')
  52.  
  53. subplot(4, 2, 7)
  54. [y, fs] = audioread('MyVoice8kHz.wav');
  55. t = 0 : 1/fs : length(y) / fs - 1 / fs;
  56. plot(t, y);
  57. title('Sygnał mowy')
  58. xlabel('Czas [s]')
  59. ylabel('Amplituda')
  60.  
  61. z = moc(y, 0.999);
  62. subplot(4, 2, 8)
  63. plot(t, z)
  64. axis([0 5 0 0.1])
  65. title('Sygnał mowy - obwiednia mocy, alfa=0.999')
  66. xlabel('Czas [s]')
  67. ylabel('Moc')
  68.  
  69.  
  70. fs = 8000;
  71. time = 5;
  72. t = 0 : 1 / fs : time - 1 / fs;
  73. y1 = randn(time * fs, 1);
  74. y1 = transpose(y1);
  75.  
  76. figure
  77. subplot(4, 2, 1)
  78. plot(t, y1)
  79. title('Szum gaussowski')
  80. xlabel('Czas [s]')
  81. ylabel('Amplituda')
  82.  
  83. z = moc(y1, 0.99);
  84. subplot(4, 2, 2)
  85. plot(t, z)
  86. axis([0 5 0 2])
  87. title('Szum gaussowski - obwiednia mocy, alfa=0.99')
  88. xlabel('Czas [s]')
  89. ylabel('Moc')
  90.  
  91. subplot(4, 2, 3)
  92. plot(t, sin(2 * pi * 1000 * t))
  93. title('Sygnał sinusoidalny o stałej częstotliwości')
  94. xlabel('Czas [s]')
  95. ylabel('Amplituda')
  96. axis([-inf inf -2 2])
  97.  
  98. z = moc(sin(2 * pi * 1000 * t), 0.99);
  99. subplot(4, 2, 4)
  100. plot(t, z)
  101. axis([0 5 0 1])
  102. title('Sygnał sinusoidalny o stałej częstotliwości - obwiednia mocy, alfa=0.99')
  103. xlabel('Czas [s]')
  104. ylabel('Moc')
  105.  
  106. subplot(4, 2, 5)
  107. y1 = chirp(t, 0, 5, 1000);
  108. plot(t, y1)
  109. title('Sygnał sinusoidalny o zmiennej częstotliwości')
  110. xlabel('Czas [s]')
  111. ylabel('Amplituda')
  112. axis([-inf inf -2 2])
  113.  
  114. z = moc(y1, 0.99);
  115. subplot(4, 2, 6)
  116. plot(t, z)
  117. axis([0 5 0 1])
  118. title('Sygnał sinusoidalny o zmiennej częstotliwości - obwiednia mocy, alfa=0.99')
  119. xlabel('Czas [s]')
  120. ylabel('Moc')
  121.  
  122. subplot(4, 2, 7)
  123. [y, fs] = audioread('MyVoice8kHz.wav');
  124. t = 0 : 1/fs : length(y) / fs - 1 / fs;
  125. plot(t, y);
  126. title('Sygnał mowy')
  127. xlabel('Czas [s]')
  128. ylabel('Amplituda')
  129.  
  130. z = moc(y, 0.99);
  131. subplot(4, 2, 8)
  132. plot(t, z)
  133. axis([0 5 0 0.2])
  134. title('Sygnał mowy - obwiednia mocy, alfa=0.999')
  135. xlabel('Czas [s]')
  136. ylabel('Moc')
Advertisement
Add Comment
Please, Sign In to add comment