Matt23

zad3.1

Nov 7th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.88 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.  
  71.  
  72.  
  73. fs = 8000;
  74. time = 5;
  75. t = 0 : 1 / fs : time - 1 / fs;
  76. y1 = randn(time * fs, 1);
  77. y1 = transpose(y1);
  78.  
  79. figure
  80. subplot(4, 2, 1)
  81. plot(t, y1)
  82. title('Szum gaussowski')
  83. xlabel('Czas [s]')
  84. ylabel('Amplituda')
  85.  
  86. z = moc(y1, 0.99);
  87. subplot(4, 2, 2)
  88. plot(t, z)
  89. axis([0 5 0 2])
  90. title('Szum gaussowski - obwiednia mocy, alfa=0.99')
  91. xlabel('Czas [s]')
  92. ylabel('Moc')
  93.  
  94. subplot(4, 2, 3)
  95. plot(t, sin(2 * pi * 1000 * t))
  96. title('Sygnał sinusoidalny o stałej częstotliwości')
  97. xlabel('Czas [s]')
  98. ylabel('Amplituda')
  99. axis([-inf inf -2 2])
  100.  
  101. z = moc(sin(2 * pi * 1000 * t), 0.99);
  102. subplot(4, 2, 4)
  103. plot(t, z)
  104. axis([0 5 0 1])
  105. title('Sygnał sinusoidalny o stałej częstotliwości - obwiednia mocy, alfa=0.99')
  106. xlabel('Czas [s]')
  107. ylabel('Moc')
  108.  
  109. subplot(4, 2, 5)
  110. y1 = chirp(t, 0, 5, 1000);
  111. plot(t, y1)
  112. title('Sygnał sinusoidalny o zmiennej częstotliwości')
  113. xlabel('Czas [s]')
  114. ylabel('Amplituda')
  115. axis([-inf inf -2 2])
  116.  
  117. z = moc(y1, 0.99);
  118. subplot(4, 2, 6)
  119. plot(t, z)
  120. axis([0 5 0 1])
  121. title('Sygnał sinusoidalny o zmiennej częstotliwości - obwiednia mocy, alfa=0.99')
  122. xlabel('Czas [s]')
  123. ylabel('Moc')
  124.  
  125. subplot(4, 2, 7)
  126. [y, fs] = audioread('MyVoice8kHz.wav');
  127. t = 0 : 1/fs : length(y) / fs - 1 / fs;
  128. plot(t, y);
  129. title('Sygnał mowy')
  130. xlabel('Czas [s]')
  131. ylabel('Amplituda')
  132.  
  133. z = moc(y, 0.99);
  134. subplot(4, 2, 8)
  135. plot(t, z)
  136. axis([0 5 0 0.2])
  137. title('Sygnał mowy - obwiednia mocy, alfa=0.999')
  138. xlabel('Czas [s]')
  139. ylabel('Moc')
Advertisement
Add Comment
Please, Sign In to add comment