Through the simulation, show that probability of getting HEAD by tossing a fair coin is about 0.5. Write your observation from the simulation run.
if possible please explain the steps as I am new

1 Kommentar

per isakson
per isakson am 20 Jan. 2022
Bearbeitet: per isakson am 20 Jan. 2022
One way
vec = randi([0,1],1,1000);
number_of_heads = sum( vec );
number_of_tails = 1000 - number_of_heads
number_of_tails = 534

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

KSSV
KSSV am 20 Jan. 2022
Bearbeitet: KSSV am 20 Jan. 2022

1 Stimme

n = 1000 ; % number of tosses
H = 0 ; % initialize Head count
T = 0 ; % initialize Tails count
% loop of toss
for i = 1:n
if rand > 0.5 % count as heads if random number is > 0.5
H = H+1 ;
else % count as tails if random num,ber is < 0.5
T = T+1 ;
end
end
% getting head
ph = H/n
ph = 0.4890
% Getting Tails
Pt = T/n
Pt = 0.5110

2 Kommentare

ANKIT  GOSWAMI
ANKIT GOSWAMI am 20 Jan. 2022
please can u explain steps
KSSV
KSSV am 20 Jan. 2022
Edited the code with comments

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics and Optimization finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2021b

Tags

Gefragt:

am 20 Jan. 2022

Bearbeitet:

am 20 Jan. 2022

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by