MATLAB: Graph cumulative sum against percentage graphpercentagesprobabilityvectors I want a graph of the cumulative percentage of two random dices that add up to 6 as a percentage of the total throws (in the subplot (2,1,2). Any advice would be great. Best Answer Use randi() and plot(). Put in a loop over a million iterations if you want to do a Monte Carlo Simulation. It's just basic programming.numberOfThrows = 1000000die1 = randi(6, [numberOfThrows, 1]);die2 = randi(6, [numberOfThrows, 1]);sixCount = 0;for t = 1 : numberOfThrows thisThrow1 = die1(t); thisThrow2 = die2(t); theSum = thisThrow1 + thisThrow2; if theSum == 6 sixCount = sixCount + 1; % etc. - I'm sure you can finish it. endend Related SolutionsMATLAB: Frequency components from a highpass filtered image Take the Fourier Transform of it. MATLAB: Trying to create an m x n (n=2 columns) matrix where n is incremented in integers starting with 1 and the second column outputs a random integer from 1 to 6 as if 1 die were being thrown n times. N = 8;dieRolls = [(1:N).', randi(6,N,1)]; Related QuestionData with NaNCreating a random game of diceWhy won’t this plot anythingHow to save all values generated by a for loop into an arrayHow to smooth a plotI need to remove randi from for loop5 person die roller
Best Answer