Question
Help with some Matlab Write a program for n loops (n=1e5), to find the values for random dice rolls for 3 dice and find out
Help with some Matlab
Write a program for n loops (n=1e5), to find the values for random dice rolls for 3 dice and find out if 2 or 3 dice have the same value in each roll. (you are not required to save the dice values for all the loops) Define variables to track this for each of the n loops. (You should have 2 variables to keep track if only 2 dice values are the same, or all 3 are). A way of doing this is to ask if dice 1s value (D1) is equal to D2 and D3 in the ath loop, if yes then S3count(a)=1, if not S3count(a)=0.
Commands: a) if D1==D2 && D2==D3 (the && acts as an AND operator) ... %option1 elseif (option to check for 2 dice overlaps you can use || as an OR operator) ... %option2 end this allows a question to be asked, depending on the answer one of two things can occur (option 1 or 2), or more options if elseif is used.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started