Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8860625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:17:59+00:00 2026-06-14T15:17:59+00:00

I created a dice function but i don’t know how to create a histogram

  • 0

I created a dice function but i don’t know how to create a histogram for it. Each bin in the histogram should represent a possible value of for the sum of the dice. For example, for NumDice = 1, the bins should span the values 1 to 6. For NumDice = 2 the bins should range from 2 to 12. thanks!

function SumDice=RollDice(NumDice,NumRolls)
NumDice=1
NumRolls=500
distribution=zeros(NumDice*6,1);
for roll=1:NumRolls
  diceValues = randi(6,[NumDice 1]);
  totaldiceValue = sum(diceValues);
        distribution(totaldiceValue) = distribution(totaldiceValue) +1;
end
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:18:01+00:00Added an answer on June 14, 2026 at 3:18 pm

    You can use the bar function to plot a bar graph when you already have the values of each bar.

    valueMin = NumDice;
    valueMax = 6 * NumDice;
    
    bar(valueMin:valueMax, distribution(valueMin:valueMax), "hist")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created the following function to create random numbers for a dice game #include
This is probably real simple, but I don't know best way to do this.
The question: Create an application that simulates rolling a pair of dice. When the
I create an app for distribution with ad-hoc, but when i drop it into
I'm trying to create a simple function to do a status test. Goal is
So I am trying to create a real simple dice game...more like a dice
Created .NET WCF service, tested it - works. Generated schemas from Data and service
Created Private Key & Self signed certficate in a Key Store keytool -genkey -alias
Created an OpenGraph action and object. Trying to submit my action. When I click
I created a python server on port 8000 using python -m SimpleHTTPServer . When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.