Advertisement
EXTREMEXPLOIT

CLT

Nov 30th, 2019
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.45 KB | None | 0 0
  1. SN = [];
  2. n = 1000000;
  3. m = 1000;
  4.  
  5. for i = 1:n
  6.     aR = [];
  7.     for j = 1:m
  8.         x = rand;
  9.         if x < 0.5
  10.             aR(j) = 1;
  11.         elseif x < 0.7
  12.             aR(j) = 2;
  13.         elseif x < 0.9
  14.             aR(j) = 3;
  15.         else
  16.             aR(j) = 4;
  17.         end
  18.     end
  19.     SN(i) = sum(aR)/sqrt(m);
  20. end
  21.  
  22. A = (var(SN));
  23.  
  24. figure(1)
  25. histogram(SN, 'Normalization', 'pdf')
  26. figure(2)
  27. histogram(SN, 'Normalization', 'cdf')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement