[SOLVED] How to find probability of die throwing on the spinner by matlab?

Status
Not open for further replies.

Rabia_khan

Newbie level 1
Joined
Feb 24, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
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)
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…