Facebook
From Ample Bison, 4 Years ago, written in Matlab M-file.
Embed
Download Paste or View Raw
Hits: 181
  1.  
  2. %cwiczenie1
  3.  
  4. M=8;
  5. A3=1.099;
  6.  
  7. N=3;
  8. mi=10;
  9. sigma=1;
  10.  
  11. Samples=sigma*randn(N,M)+mi;
  12.  
  13.  
  14. subplot(3,1,1)
  15.  
  16. for i=1:1:N
  17.     plot(Samples(i,:),'.');
  18.     xlabel('numer próbki')
  19.     ylabel('wartość')
  20.     hold on
  21. end
  22.  
  23.  
  24.  
  25. Average=zeros(M);
  26.  
  27. for m=1:1:M
  28.     for n=1:1:N
  29.         Average(m)=Average(m)+Samples(n,m);
  30.     end
  31. end
  32.  
  33. for m=1:1:M
  34.         Average(m)=Average(m)/N;
  35. end
  36.  
  37. subplot(3,1,2)
  38. plot(Average(:,1),'.')
  39. xlabel('numer próbki')
  40. ylabel('wartość średnia')
  41.  
  42. Standard=zeros(N,M);
  43. Dev=zeros(M);
  44. for m=1:1:M
  45.     for n=1:1:N
  46.         Standard(n,m)=Samples(n,m)-Average(m);
  47.     end
  48. end
  49.  
  50. for m=1:1:M
  51.     for n=1:1:N
  52.         Dev(m)=Dev(m)+(Standard(n,m)*Standard(n,m));
  53.     end
  54. end
  55.  
  56. for m=1:1:M
  57.         Dev(m)=sqrt(Dev(m));
  58. end
  59.  
  60. subplot(3,1,3)
  61. plot(Dev(:,1),'.')
  62. xlabel('numer próbki')
  63. ylabel('wartość odchylenia')
  64.  
  65. %ćwiczenie 2
  66. boxplot(Samples)
  67.  
  68. %ćwiczenie 3
  69. AveAverage=0;
  70. for a=1:1:M
  71. AveAverage=AveAverage+Average(a);
  72. end
  73. AveAverage=AveAverage/M;
  74.  
  75. S=mean(std(Samples));
  76.  
  77. GLK=AveAverage+A3*S;
  78. DLK=AveAverage-A3*S;
  79.  
  80. %ćwiczenie 4
  81.  
  82. B3=0;
  83. B4=2.568;
  84.  
  85. DLK2=B3*S;
  86. GLK2=B4*S;
  87.  
  88.  
  89.  
  90. subplot(3,1,1)
  91.  
  92. for i=1:1:N
  93.     plot(Samples(i,:),'.');
  94.     xlabel('numer próbki')
  95.     ylabel('wartość')
  96.     hold on
  97. end
  98.  
  99.  
  100.  
  101. Average=zeros(M);
  102.  
  103. for m=1:1:M
  104.     for n=1:1:N
  105.         Average(m)=Average(m)+Samples(n,m);
  106.     end
  107. end
  108.  
  109. for m=1:1:M
  110.         Average(m)=Average(m)/N;
  111. end
  112.  
  113. subplot(3,1,2)
  114. plot(Average(:,1),'.')
  115. xlabel('numer próbki')
  116. ylabel('wartość średnia')
  117. refline([0 GLK])
  118. refline([0 DLK])
  119.  
  120. Standard=zeros(N,M);
  121. Dev=zeros(M);
  122. for m=1:1:M
  123.     for n=1:1:N
  124.         Standard(n,m)=Samples(n,m)-Average(m);
  125.     end
  126. end
  127.  
  128. for m=1:1:M
  129.     for n=1:1:N
  130.         Dev(m)=Dev(m)+(Standard(n,m)*Standard(n,m));
  131.     end
  132. end
  133.  
  134. for m=1:1:M
  135.         Dev(m)=sqrt(Dev(m));
  136. end
  137.  
  138. subplot(3,1,3)
  139. plot(Dev(:,1),'.')
  140. xlabel('numer próbki')
  141. ylabel('wartość odchylenia')
  142. refline([0 GLK2])
  143. refline([0 DLK2])
  144.  
  145.