%
%  math495/stat490 -- 02 october 03 -- djm
%
%  w05vote.m:

%  initialize settings 
rand('state',7654321)
Nv = 1000000;  p = 0.64;  q = 1-p;  Npolls = 1;
n = input('poll size = ');

%  make a million happy, voting citizens
voter = (rand(Nv,1)<p);

true_p = sum(voter)/Nv;  true_q = 1-true_p;
disp(['true_p true_q = (' num2str(true_p) ',' num2str(true_q) ')'])

%  conduct Npolls sample polls
polls = zeros(Npolls,1);

for m=1:Npolls
    %  put poll routine here
    polled = ceil(rand(n,1)*Nv);
end

%  put graphing commands here

whos