Question

# How to perform Matlab for the biased coin toss

Let the bias be the probability of turning up a head and denoted by the parameter q.

If we use a coin with the bias specified by q to conduct a coin flipping process d times, the outcome will be a sequence of heads and tails.

Then the probability - where nH is the number of heads turned up during d trials.

Now using such a simulated coin with q = ½ to conduct the experiments based on a sequence of outcomes generated by the random generator from computer.

For example, if the number generated by the random generator is less than 1/2, it assigned to be 0; otherwise, it will be assigned 1.

I would like to perform the Matlab programming with certain parameters for the Pattern Recognition (such as Binomial Distribution) as below -

(1) d = 100 and n =100 using a simulated coin with q = ¼ and ½.

(2) d = 10 and n =1000 using a simulated coin with q = ¼ and ½.

(3) d = 100 and n = 1000 using a simulated coin with q = ¼ and ½.

Kindly please provide your opinion and suggestion thus I will be able to improve my computing skills.

(The result of the execution from program will be drawn into histogram on the PowerPoint)

Discussion is locked
You are posting a reply to: How to perform Matlab for the biased coin toss
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: How to perform Matlab for the biased coin toss
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.

Collapse -
I worry you skipped research on this.

In reply to: How to perform Matlab for the biased coin toss

Collapse -
I get some errors for my coding

In reply to: I worry you skipped research on this.

Matlab Programming Method - I get some errors for my coding sample as below

(1)

x = rand(0,1);
if(x<0.25),
else
toss = 1; %Tail
end
n = 100;
d = 100;
hist(y,0:n)

x = rand(0,1);
if(x<0.5),
else
toss = 1; %Tail
end
n = 100;
d = 100;
hist(y,0:n)
Collapse -
For that, find coding forums.

In reply to: I get some errors for my coding

## Popular Forums

icon
Computer Newbies 10,686 discussions
icon
Computer Help 54,365 discussions
icon
Laptops 21,181 discussions
icon
Networking & Wireless 16,313 discussions
icon
Phones 17,137 discussions
icon
Security 31,287 discussions
icon
TVs & Home Theaters 22,101 discussions
icon
Windows 7 8,164 discussions
icon
Windows 10 2,657 discussions

## GRAMMYS 2019

Here's Everything to Know About the 2019 Grammys

Find out how to watch the Grammy Awards if you don't have cable and more.