From: Judas Magnus on
I want to plot a histogram of 12000 sums each of 10 pairs of 5-sided die rolls.

I have this

Die = sum(ceil(5*rand(12000,10)),2)
Plot = hist(Die)

Is that correct? Also when i try to use the histogram on it i don't see the histogram output form. All i get is numbers on the matlab command window
From: the cyclist on
"Judas Magnus" <ragnaork5435(a)yahoo.com> wrote in message <hp08as$709$1(a)fred.mathworks.com>...
> I want to plot a histogram of 12000 sums each of 10 pairs of 5-sided die rolls.
>
> I have this
>
> Die = sum(ceil(5*rand(12000,10)),2)
> Plot = hist(Die)
>
> Is that correct? Also when i try to use the histogram on it i don't see the histogram output form. All i get is numbers on the matlab command window

If you carefully read the documentation for the HIST function, you will see that if you assign the output of HIST to a variable, it does not create the plot. You will need to either use BAR to plot the values in your variable "Plot", or call HIST again without using the output argument.

I recommend not using the variable name "plot", which is a keyword in MATLAB. (Granted, you have given in different capitalization, but still, it's not a good practice.)

the cyclist
From: Judas Magnus on
ah thanks!!


"the cyclist" <thecyclist(a)gmail.com> wrote in message <hp08ro$gqc$1(a)fred.mathworks.com>...
> "Judas Magnus" <ragnaork5435(a)yahoo.com> wrote in message <hp08as$709$1(a)fred.mathworks.com>...
> > I want to plot a histogram of 12000 sums each of 10 pairs of 5-sided die rolls.
> >
> > I have this
> >
> > Die = sum(ceil(5*rand(12000,10)),2)
> > Plot = hist(Die)
> >
> > Is that correct? Also when i try to use the histogram on it i don't see the histogram output form. All i get is numbers on the matlab command window
>
> If you carefully read the documentation for the HIST function, you will see that if you assign the output of HIST to a variable, it does not create the plot. You will need to either use BAR to plot the values in your variable "Plot", or call HIST again without using the output argument.
>
> I recommend not using the variable name "plot", which is a keyword in MATLAB. (Granted, you have given in different capitalization, but still, it's not a good practice.)
>
> the cyclist
 | 
Pages: 1
Prev: motion detection
Next: HDL coder and vectors