# Answer to Question #60104 in MatLAB | Mathematica | MathCAD | Maple for faisal

Question #60104

Write some statements to simulate spinning a coin 50 times using 0–1

vectors instead of a for loop. Hints: generate a vector of 50 random

numbers, set up 0–1 vectors to represent the heads and tails, and use

double and char to display them as a string of Hs and Ts.

vectors instead of a for loop. Hints: generate a vector of 50 random

numbers, set up 0–1 vectors to represent the heads and tails, and use

double and char to display them as a string of Hs and Ts.

Expert's answer

Solution

letters='HT';

S=letters(round(rand(1,50))+1)

Result:

S =

HHHHHHTHHTTHHHTHHTTTHHHHHTTTHTHHTTHHTHTTHHHHTHTHHT

letters='HT';

S=letters(round(rand(1,50))+1)

Result:

S =

HHHHHHTHHTTHHHTHHTTTHHHHHTTTHTHHTTHHTHTTHHHHTHTHHT

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment