Advertisement
rozman50

Octave

Dec 3rd, 2018
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Octave 0.33 KB | None | 0 0
  1. // polnjenje vektorja z naključnimi števili
  2. P = [];
  3. for i=1:1:10;
  4. P(i) = randi([1, 100]);
  5. end;
  6.  
  7. // izračun povprečja
  8. vsota = 0;
  9. for i=1:1:10;
  10. vsota = vsota + P(i);
  11. end;
  12. povcprecje = vsota / 10;
  13.  
  14. // standardna deviacija
  15. vsotaStd = 0;
  16. for i=1:1:10;
  17. vsotaStd = vsotaStd + (P(i) - povprecje)^2;
  18. end;
  19. std = sqrt(vsotaStd);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement