Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Suppose an experiment calls for an unfair coin to be flipped 10 times. The proba

ID: 3849547 • Letter: S

Question

Suppose an experiment calls for an unfair coin to be flipped 10 times. The probability of getting heads is known to be 0.6. Write a MATLAB script that simulates flipping this unfair coin 10 times, and shows the results by displaying the letter "H" for getting heads and the letter "T" for getting tails. Write a MATLAB script to generate a vector x with 10 dimensions where each entry is sampled from a distribution with probability 0.5 for value 1, 0.3 for value 2, and 0.2 for value 3. The vector requires pre-allocation.

Explanation / Answer

(c)for i=1:10
if randi([1 2])==1
display('H');
else
display('T');
end
end

(d)R = randsample('123',10,true,[0.5 0.3 0.2])

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote