Question: please Use MATLAB to solve the below questions there are some kind of similar examples for this question which may help you to solve the
please Use MATLAB to solve the below questions
there are some kind of similar examples for this question which may help you to solve the below problems
guideline
examples
questions
no_trials = 8; trials = [1, 0, 1, 1, 0, 1, 1, 0]; %3! We can now use the MATLAB command sum and a logical array to work out the total heads and tails total_no_heads = sum(trials == 1) total_no_tails = sum(trials == 0) We can now use the MATLAB command cumsum and a logical array to work out the cumulative heads and tails cuml_no_heads = cumsum(trials == 1) cuml_no_tails = cumsum(trials == 0) >> total_no_heads = sum (trials 1) total no heads = > total_no_tails = sum (trials == 0) total_no tails = 3 cuml_no_heads = cumsum (trials == 1) cuml_no heads = 4 >> cuml_no_ tails = cumsum (trials cuml_no_tails = 2 2 3 3. 3. no_trials = 8; trials = [1, 0, 1, 1, 0, 1, 1, 0]; cumsum(trials==1)./(1:no_trials)*100 1. Simulate a fair coin toss over 1000 trials Plot the frequency of heads and the frequency of tails per trial. a. b. Plot the relative frequency of heads and the frequency of tails per trial. c. Simulate an unfair coin toss with P(X = H) = 0.7, P(X = T) = 0.3 2. Each run of your program can be considered as an experiment and is by nature stochastic. This means that the results will differ on each run due to the randomness. Adapt your code to repeat the fair coin toss experiment 10 times with each experiment consisting of 100 trials. Average the frequency of heads and the frequency of tails seen after each experiment. i.e. You are averaging the results of the 10 experiments. How does this compare with the simulation of 1000 trials?
Step by Step Solution
3.31 Rating (154 Votes )
There are 3 Steps involved in it
To solve these MATLAB questions you can follow these steps 1 Simulating a Fair Coin Toss over 1000 Trials 1 Generate Random Trials Use randi to simula... View full answer
Get step-by-step solutions from verified subject matter experts
