Advertisement
Guest User

Untitled

a guest
Oct 27th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.20 KB | None | 0 0
  1. clear all;
  2. close all;
  3. figure;
  4. %Podpunkt a
  5. zakres = [-100 : 1 : 100];
  6. dlugosc = length(zakres);
  7. y = zeros(1, dlugosc);
  8. y(floor(dlugosc / 2)) = 1;
  9. subplot(2, 3, 1);
  10. stem(zakres, y);
  11. title('Impuls jedn');
  12. xlabel('Probki');
  13. ylabel('Wartosci');
  14.  
  15. zakres = [-100 : 1 : 100];
  16. dlugosc = length(zakres);
  17. y = zeros(1, dlugosc);
  18. y(floor(dlugosc / 2)) = 1;
  19. subplot(2, 3, 2);
  20. stem(zakres + 40, y);
  21. axis([-60 140 0 1]);
  22. title('Impuls przes o 40');
  23. xlabel('Probki');
  24. ylabel('Wartosci');
  25.  
  26. %B
  27. %Sine
  28. x = [0 : pi/20 : 10*pi];
  29. y = sin(x);
  30. subplot(2, 3, 3);
  31. stem(x, y);
  32. axis([0 35 -1 1]);
  33. title('Sinus');
  34. xlabel('Probki');
  35. ylabel('Wartosci');
  36.  
  37. %Sawtooth
  38. x = [0 : pi/20 : 10*pi];
  39. y = sawtooth(x);
  40. subplot(2, 3, 4);
  41. stem(x, y);
  42. axis([0 35 -1 1]);
  43. title('Sawtooth');
  44. xlabel('Probki');
  45. ylabel('Wartosci');
  46.  
  47. %Square
  48. x = [0 : pi/20 : 10*pi];
  49. y = square(x);
  50. subplot(2, 3, 5);
  51. stem(x, y);
  52. axis([0 35 -1 1]);
  53. title('Square');
  54. xlabel('Probki');
  55. ylabel('Wartosci');
  56.  
  57. %C
  58. ilosc_probek = 200;
  59. przesuniecie = 0;
  60. sigma = 0.5;
  61. y = sigma + randn(ilosc_probek, 1) + przesuniecie;
  62. subplot(2, 3, 6);
  63. stem(y);
  64. title('Szum gaussowski');
  65. xlabel('Probki');
  66. ylabel('Wartosci');
  67. grid on;
  68. axis([0 200 -5 5]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement