makispaiktis

Tutorial Thomas - Pie Charts

Jul 24th, 2021 (edited)
817
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clc
  2. clear all
  3.  
  4. N = 1000;
  5. counters = zeros(1, 5);     % This will count how many times each number appears
  6. % I will create a vector with va;ues 1,2,3,4 and 5 following uniform distribution
  7. for i = 1:N
  8.     value = randi([1, 5]);
  9.     counters(value) = counters(value) + 1;
  10. end
  11. legendsOfPie = {'1', '2', '3', '4', '5'};
  12. pie(counters);
  13. title("Possibilities of numbers' appearances");
  14. legend(legendsOfPie);
RAW Paste Data