Advertisement
Luszak

pps5-zad1

Dec 9th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.34 KB | None | 0 0
  1. clear all;
  2. t=0:1/10000:5;
  3. N = length(t);
  4. sinus = 3*sin(2*pi*14*t+pi/3);
  5. prostk = square(5*t);
  6. narast = 1/2*t+3;
  7. jednost = rand(1,size(t,2));
  8. gauss = randn(1,size(t,2));
  9.  
  10. [h1,ox1] = hist(sinus,100);
  11. [h2,ox2] = hist(prostk,100);
  12. [h3,ox3] = hist(narast,100);
  13. [h4,ox4] = hist(jednost,100);
  14. [h5,ox5] = hist(gauss,100);
  15.  
  16. g1 = h1/N;
  17. g2 = h2/N;
  18. g3 = h3/N;
  19. g4 = h4/N;
  20. g5 = h5/N;
  21.  
  22. F1 = cumsum(g1);
  23. F2 = cumsum(g2);
  24. F3 = cumsum(g3);
  25. F4 = cumsum(g4);
  26. F5 = cumsum(g5);
  27.  
  28. [kox1,kor1] = xcorr(sinus,'unbiased');
  29. [kox2,kor2] = xcorr(prostk, 'unbiased');
  30. [kox3,kor3] = xcorr(narast, 'unbiased');
  31. [kox4,kor4] = xcorr(jednost, 'unbiased');
  32. [kox5,kor5] = xcorr(gauss, 'unbiased');
  33.  
  34. figure();
  35. subplot(411);
  36. plot(t,sinus);
  37. subplot(412);
  38. plot(ox1,g1);
  39. subplot(413);
  40. plot(ox1,F1);
  41. subplot(414);
  42. plot(ox1,kor1);
  43.  
  44. figure();
  45. subplot(411);
  46. plot(t,prostk);
  47. subplot(412);
  48. plot(ox2,g2);
  49. subplot(413);
  50. plot(ox2,F2);
  51. subplot(414);
  52. plot(ox2,kor2);
  53.  
  54. figure();
  55. subplot(411);
  56. plot(t,jednost);
  57. subplot(412);
  58. plot(ox4,g4);
  59. subplot(413);
  60. plot(ox4,F4);
  61. subplot(414);
  62. plot(ox4,kor4);
  63.  
  64. figure();
  65. subplot(411);
  66. plot(t,narast);
  67. subplot(412);
  68. plot(ox3,g3);
  69. subplot(413);
  70. plot(ox3,F3);
  71. subplot(414);
  72. plot(ox3, kor3);
  73.  
  74. figure();
  75. subplot(411);
  76. plot(t,gauss);
  77. subplot(412);
  78. plot(ox5,g5);
  79. subplot(413);
  80. plot(ox5,F5);
  81. subplot(414);
  82. plot(ox5,kor5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement