I'm asked to find the probability of this problem :(
Mostrar comentarios más antiguos
hello all, we had this problem in the class and we asked to verify the answer using MATLAB (answer=0.13867), so I write the following code:
if true
>> a= rand;
b=rand;
c=rand;
e=rand;
d=rand;
x=0.251;
n=0;
p=0;
for i=1: 10000
if (a<x)
a=1;
else
a=0;
end
if (b<x)
b=1;
else
b=0;
end
if (c<x)
c=1;
else
c=0;
end
if (d<x)
d=1;
else
d=0;
end
if (e<x)
e=1;
else
e=0;
end
p = (a*b)+ (a*e*d)+(c*d)+(c*e*b);
if (p>=1)
n=n+1;
end
end;
n/10000 end
and the answer appears is either 1 or 0.5, what is wrong? thanks ahead, I've to submitting it tomorrow, pls help
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Parallel Computing en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!