Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Courses LMS Integration Documentation AESC 210 - SS20 > Project 4 - Dice > Test Case 2 O solutions submitted (max: 4) Enter your function

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
Courses LMS Integration Documentation AESC 210 - SS20 > Project 4 - Dice > Test Case 2 O solutions submitted (max: 4) Enter your function from Test Case 2 into the space below. Click the run button to test your code output using the provided script Click the submit button to have your work assessed. Case 2: One die. Three sets of rolls. INPUTS: $. rollseti, array of rolls (1 x nrollsi) rollset2, array of rolls (1 x nrolls2) % rollSet3, array of rolls (1 x nrolls3) % OUTPUTS: binpctarr, bin pcts for each set (3 x 6) Note. binpctarr(1.1:6) is for set 1, etc. difsqbinpctarr, diff squared for binpcts (3 x 6) variances, mean difsquares for each set (3 x 6) Function 1 function [binfracs,difsqbinfracs, variances)= Dice_2_fcnrollSet1.rollset2, rollSet 3 ) Copy and paste your code here Code to call your function MacBook Air CIOS Code to call your function 2% Case 2: One die. Three sets of rolls. INPUTS: 4 rollSeti, array of rolls (1 x nrolls1) rollset2, array of rolls (1 x nrolls2) rollSet3, array of rolls (1 x nrolls3) 7 % OUTPUTS: binpctarr, bin pcts for each set (3 X 6) Note. binpctarr(1,1:6) is for set 1, etc. difsqbinpctarr, diff squared for binpcts (3 x 6) 11 variances, mean difsquares for each set (3 x 6) 14 SETUP SECTION - 15 % generate roll sets 16 nrollsi= 12; 17 nrolls2= 120; 18 nrolls3= 1200; 20 rollset1= zeros(1, nrollsi); 21 rollSet 2= zeros(1, nrolls2); 22 rollSet 3= zeros(1, nrolls3); for nr=1:1:nrollsi rollset1(1, nr)= randi(6); 26 end 27 for nr=1:1:nrolls2 rollset2(1, nr)= randi(6); 29 end 30 for nr=1:1:nrolls 31 rollSet3(1,nr) randi(6): 32 end MacBook Air # $ % ^ & * ose Courses LMS Integration Documentation 29 Trend 3e for nr=1:1:nrolls3 31 rollSet3(1, nr)= randi (6); 32 end 34 SIMULATION SECTION -- 35 [binfracs, difsqbinfracs, variances)- Dice_2_fon( rollset1, rollSet2,rollset3 ); 37 DISPLAY SECTION 38 % setup section 39 fprintf(" Dice 2 setup: '); 40 fprintf(" rollset 1 2 3 '); 41 fprintf(nrolls $4.0f 14.0f $4.0f ',nrollsi, nrolls2,nrolls3); 42 fmt1= [' rollset (1,1:12)= [', repmat('43.0f',1,12), 'l ']; 43 fprintf(fmt1, rollSet(1, 1:12)); 44 mean1= mean(rollseti); 45 mean2= mean(rollSet2); 46 mean3= mean(rollset3); 47 fprintf(' means $4.2f $4.2f $4.2f ', meani, mean2, mean3); 49 % results section 50 fprintf(' Dice 2 results: '); 51 fmt2= ['in bincountel.repmat('45.0f', 1,6),' l ); 52fprintf(fmt2, bincount(1, 1:6)); 53 fmt3= [' binfracs l', repmat('47.37, 1,6), I '); 54 fprintf(fmt3, binfracs(1,:)); 55 fprintf(fmt3, binfracs (2,:)); 56 fprintf(fmt3, binfracs (3,:)); '); 58 fmt4= [' difsqbinfracs l', repmat('19.68', 1,6), 59 fprintf(fmt4,difsqbinfracs (1,:)); 60 fprintf(fmt4,difsgbinfracs(2,:)); 61 fprintf(fmt4,difsqbinfracs (3,:)); 63 fprintf(' variances 19.6f 19.6f 19.6f ', variances (1:3,1)); 65 fprintf(' '); MacBook Air CASE 2: ONE DIE, THREE SETS OF ROLLS Setup: Make 3 sets of rolls - nrolls 1, nrolls2, nrolls3 Outcome: 3 sets of roll results - rollSet1*(1 x nrolls 1), etc. How to study the results? o Bin percentages:binpcti, binpct2, binpct3 (1x6) o Absolute deviation of binpcts fom expected values: absdevbinpct1, absdevbinpct2, absdevbinpct3 What is absolute deviation of binpct? CASE 3. TWO DICE MacBook Air 90 Courses LMS Integration Documentation AESC 210 - SS20 > Project 4 - Dice > Test Case 2 O solutions submitted (max: 4) Enter your function from Test Case 2 into the space below. Click the run button to test your code output using the provided script Click the submit button to have your work assessed. Case 2: One die. Three sets of rolls. INPUTS: $. rollseti, array of rolls (1 x nrollsi) rollset2, array of rolls (1 x nrolls2) % rollSet3, array of rolls (1 x nrolls3) % OUTPUTS: binpctarr, bin pcts for each set (3 x 6) Note. binpctarr(1.1:6) is for set 1, etc. difsqbinpctarr, diff squared for binpcts (3 x 6) variances, mean difsquares for each set (3 x 6) Function 1 function [binfracs,difsqbinfracs, variances)= Dice_2_fcnrollSet1.rollset2, rollSet 3 ) Copy and paste your code here Code to call your function MacBook Air CIOS Code to call your function 2% Case 2: One die. Three sets of rolls. INPUTS: 4 rollSeti, array of rolls (1 x nrolls1) rollset2, array of rolls (1 x nrolls2) rollSet3, array of rolls (1 x nrolls3) 7 % OUTPUTS: binpctarr, bin pcts for each set (3 X 6) Note. binpctarr(1,1:6) is for set 1, etc. difsqbinpctarr, diff squared for binpcts (3 x 6) 11 variances, mean difsquares for each set (3 x 6) 14 SETUP SECTION - 15 % generate roll sets 16 nrollsi= 12; 17 nrolls2= 120; 18 nrolls3= 1200; 20 rollset1= zeros(1, nrollsi); 21 rollSet 2= zeros(1, nrolls2); 22 rollSet 3= zeros(1, nrolls3); for nr=1:1:nrollsi rollset1(1, nr)= randi(6); 26 end 27 for nr=1:1:nrolls2 rollset2(1, nr)= randi(6); 29 end 30 for nr=1:1:nrolls 31 rollSet3(1,nr) randi(6): 32 end MacBook Air # $ % ^ & * ose Courses LMS Integration Documentation 29 Trend 3e for nr=1:1:nrolls3 31 rollSet3(1, nr)= randi (6); 32 end 34 SIMULATION SECTION -- 35 [binfracs, difsqbinfracs, variances)- Dice_2_fon( rollset1, rollSet2,rollset3 ); 37 DISPLAY SECTION 38 % setup section 39 fprintf(" Dice 2 setup: '); 40 fprintf(" rollset 1 2 3 '); 41 fprintf(nrolls $4.0f 14.0f $4.0f ',nrollsi, nrolls2,nrolls3); 42 fmt1= [' rollset (1,1:12)= [', repmat('43.0f',1,12), 'l ']; 43 fprintf(fmt1, rollSet(1, 1:12)); 44 mean1= mean(rollseti); 45 mean2= mean(rollSet2); 46 mean3= mean(rollset3); 47 fprintf(' means $4.2f $4.2f $4.2f ', meani, mean2, mean3); 49 % results section 50 fprintf(' Dice 2 results: '); 51 fmt2= ['in bincountel.repmat('45.0f', 1,6),' l ); 52fprintf(fmt2, bincount(1, 1:6)); 53 fmt3= [' binfracs l', repmat('47.37, 1,6), I '); 54 fprintf(fmt3, binfracs(1,:)); 55 fprintf(fmt3, binfracs (2,:)); 56 fprintf(fmt3, binfracs (3,:)); '); 58 fmt4= [' difsqbinfracs l', repmat('19.68', 1,6), 59 fprintf(fmt4,difsqbinfracs (1,:)); 60 fprintf(fmt4,difsgbinfracs(2,:)); 61 fprintf(fmt4,difsqbinfracs (3,:)); 63 fprintf(' variances 19.6f 19.6f 19.6f ', variances (1:3,1)); 65 fprintf(' '); MacBook Air CASE 2: ONE DIE, THREE SETS OF ROLLS Setup: Make 3 sets of rolls - nrolls 1, nrolls2, nrolls3 Outcome: 3 sets of roll results - rollSet1*(1 x nrolls 1), etc. How to study the results? o Bin percentages:binpcti, binpct2, binpct3 (1x6) o Absolute deviation of binpcts fom expected values: absdevbinpct1, absdevbinpct2, absdevbinpct3 What is absolute deviation of binpct? CASE 3. TWO DICE MacBook Air 90

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions