Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. %% question 2 (a)
  2.  
  3. % define constants
  4. n = 450;
  5. p = 0.015;
  6.  
  7. % calculate probabilities of students missing exams
  8. prob0 = (p.^0).*((1 - p).^(n - 0))
  9. prob1 = n.*(p.^1).*((1 - p).^(n - 1))
  10. prob2 = ((n.*(n - 1))/factorial(2)).*(p.^2).*((1 - p).^(n - 2))
  11. prob3 = ((n.*(n - 1).*(n - 2))/factorial(3)).*(p.^3).*((1 - p).^(n - 3))
  12. prob4 = ((n.*(n - 1).*(n - 2).*(n - 3))/factorial(4)).*(p.^4).*((1 - p).^(n - 4));
  13. prob5 = ((n.*(n - 1).*(n - 2).*(n - 3).*(n - 4))/factorial(5)).*(p.^5).*((1 - p).^(n - 5))
  14. prob6 = ((n.*(n - 1).*(n - 2).*(n - 3).*(n - 4).*(n - 5))/factorial(6)).*(p.^6).*((1 - p).^(n - 6))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement