MATLAB: The probability of winning

MATLABprobability of winning an election

You are the only sane voter in a state with candidates running for Senate. There are N other people in the state and each one votes completely randomly. All voters act independently and are equally likely to vote for either candidate (i.e., they choose their vote by a coin flip). What are the odds that your vote changes the outcome of the election? Specifically, how do these odds scale with the number of people in the state? You can keep your "state" population small… The answer should be apparent by 100,000. What is a simple function (i.e., b/N²) that describes the odds, where b is a constant? Can you find any special meaning for b?
This is what I have done I am not sure what they mean about drawing the graph and stuff.
>> P=1/n;
>> rand(P)
ans =
0.0975 0.9575 0.9706
0.2785 0.9649 0.9572
0.5469 0.1576 0.4854

Best Answer

count=1;
odds=zeros(1,100);
for n=2:100:10000
b=sym(((n/2+1):n)/4);
c=sym(1:(n/2));
a=prod(b./c);
odds(count)=double(a/(1-a));
count=count+1;
end
plot(2:100:10000,odds);