Rabia_khan
Newbie level 1
here i calculated the probability of a die when thrown on a spinner but the output p which is the total probability of a spinner and die is giving the value "0".
Can anybody help me in this regard.
Thanx
NUM_TRIALS = 500;
trials = 1:NUM_TRIALS;
t = ceil(24*rand(1,NUM_TRIALS));
s = zeros(size(t))
p = zeros(size(t))
for i=trials
for n=1:24
if (t==n)
s=s+1
p=s./trials
else
end
end
end
plot(trials,p)
Can anybody help me in this regard.
Thanx
NUM_TRIALS = 500;
trials = 1:NUM_TRIALS;
t = ceil(24*rand(1,NUM_TRIALS));
s = zeros(size(t))
p = zeros(size(t))
for i=trials
for n=1:24
if (t==n)
s=s+1
p=s./trials
else
end
end
end
plot(trials,p)