Computers and Technology

(Using Matlab):For this Project you will simulate sequentially flipping a coin 10000 times. Keep track of every time you get 'heads' and plot the running estimate of the probability of getting 'heads'
with this coin. Plot this running estimate along with a horizontal line at the expected value of
0.5 in a subplot. You will animate the running estimate line. In the second subplot you will
have a animated bar plot with the x axis being heads and tails and the y axis is a running
estimate of the number of heads or tails. The x axis tick marks must say heads and tails for
each bar. To create the random data, you will use the following code shown below; where n is the
number of coin flips. In the data heads is represented as O and tails is represented as 1. The axis of
the bar and line plot cannot change as the animation goes on. You do not have to animate the
horizontal line. You may use any code cover in class to complete this.
The probability of an outcome can be computed using the following formula:
h
P=
ht
Where h is the current total of heads result and t is the current total of tails result
To generate the data, you will use the following code (Copy this exactly):
d - randi (2, n, 1)-2;
To create an animated bar plot, you just repeated plot the bar plot with the updated results.
To set the x axis tick marks to say heads and tails for each bar, you will use the following
code:
str - (Heads''Tails);
set (gca, 'XTickLabel', str, 'XTick', 1:numel (str))
To set the y axis limits for the bar plot you can use the code: ylim

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 19:20, bob4059
1)consider the following code snippet: #ifndef book_h#define book_hconst double max_cost = 1000.0; class book{public: book(); book(double new_cost); void set_cost(double new_cost); double get_cost() const; private: double cost; }; double calculate_terms(book bk); #endifwhich of the following is correct? a)the header file is correct as given. b)the definition of max_cost should be removed since header files should not contain constants. c)the definition of book should be removed since header files should not contain class definitions. d)the body of the calculate_terms function should be added to the header file.
Answers: 1
image
Computers and Technology, 22.06.2019 19:30, bstine6678
When creating a presentation in libre office impress, where does the editing of slides take place? a. the slides panel b. the center panel c. the tasks panel, under the masters pages tab d. the tasks panel, under the layouts tab
Answers: 1
image
Computers and Technology, 23.06.2019 19:30, wilkinsonei4069
Anul 2017 tocmai s-a încheiat, suntem trişti deoarece era număr prim, însă avem şi o veste bună, anul 2018 este produs de două numere prime, 2 şi 1009. dorel, un adevărat colecţionar de numere prime, şi-a pus întrebarea: “câte numere dintr-un interval [a, b] se pot scrie ca produs de două numere prime? “.
Answers: 1
image
Computers and Technology, 24.06.2019 07:40, daebreonnakelly
What type of multimedia are live news feeds? live news feeds are examples of multimedia.
Answers: 2
Do you know the correct answer?
(Using Matlab):For this Project you will simulate sequentially flipping a coin 10000 times. Keep tra...

Questions in other subjects: