Solutionimage

image

11. The Case of the Missing Senators

The code missing.m simulates the problem of the absentee senators. Lines 01 and 02 are by now obvious to you. Line 03 initializes the variable defeats to zero; the value of this variable, at the end of the program execution, will be how many times the bill was defeated during one million simulated votes. Lines 04 and 26 define the for/end loop that cycles the code through its one million simulations. Line 05 defines the 100-element row vector votes; votes(k) is the vote during an individual simulation ...

Get Digital Dice now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.