Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # МС_ЛР_1_АЛЕКНА
- V = 23;
- n = 5 + mod(V, 16);
- p = 0.1 + 0.01 * V;
- lambda = 0.5 + 0.1 * V;
- x = binornd(n, p, [1 200]);
- x = sort(x);
- #statistic series
- stats = statseries(x, 200);
- #plot(stats(1, :), stats(3, :))
- axis([stats(1,1), stats(1, end), 0, 1]);
- plot(stats(1, :), cumsum(stats(3, :)))
- -------------------------------------
- function y = statseries(x, size)
- stats = [x(1); 1];
- cur = 1;
- for i = 2 : size
- if (x(i) == stats(1, cur))
- stats(2, cur) = stats(2, cur) + 1;
- else
- cur = cur + 1;
- stats = [stats, [x(i); 1]];
- endif
- end
- w = stats(2, :) / sum(stats(2, :));
- stats(3, :) = w;
- y = stats;
- endfunction
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement