Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
create histogram

Subject: create histogram

From: Pink Panther

Date: 5 Jan, 2011 14:33:05

Message: 1 of 6

hi,
what could be the code to create a histogram out of vector ? for example, let's take a normalized random serie
V=normrnd(0,5,50,1);
I'd like to write the code to create a histogram out of these 50 lines. Obviously in this case the histogram should very much look like a bell curve mean 0 std deviation 5, and the idea could be applied to any type of data
many thanks in advance

Subject: create histogram

From: Greg von Winckel

Date: 5 Jan, 2011 14:45:22

Message: 2 of 6

Check out the Matlab function HIST.

"Pink Panther" wrote in message <ig1vf1$rto$1@fred.mathworks.com>...
> hi,
> what could be the code to create a histogram out of vector ? for example, let's take a normalized random serie
> V=normrnd(0,5,50,1);
> I'd like to write the code to create a histogram out of these 50 lines. Obviously in this case the histogram should very much look like a bell curve mean 0 std deviation 5, and the idea could be applied to any type of data
> many thanks in advance

Subject: create histogram

From: Wayne King

Date: 5 Jan, 2011 14:48:05

Message: 3 of 6

"Pink Panther" wrote in message <ig1vf1$rto$1@fred.mathworks.com>...
> hi,
> what could be the code to create a histogram out of vector ? for example, let's take a normalized random serie
> V=normrnd(0,5,50,1);
> I'd like to write the code to create a histogram out of these 50 lines. Obviously in this case the histogram should very much look like a bell curve mean 0 std deviation 5, and the idea could be applied to any type of data
> many thanks in advance

Hi, do you mean beside?

hist(V)

Wayne

Subject: create histogram

From: Pink Panther

Date: 5 Jan, 2011 15:19:04

Message: 4 of 6

"Wayne King" <wmkingty@gmail.com> wrote in message <ig20b5$p5m$1@fred.mathworks.com>...
> "Pink Panther" wrote in message <ig1vf1$rto$1@fred.mathworks.com>...
> > hi,
> > what could be the code to create a histogram out of vector ? for example, let's take a normalized random serie
> > V=normrnd(0,5,50,1);
> > I'd like to write the code to create a histogram out of these 50 lines. Obviously in this case the histogram should very much look like a bell curve mean 0 std deviation 5, and the idea could be applied to any type of data
> > many thanks in advance
>
> Hi, do you mean beside?
>
> hist(V)
>
> Wayne

that was so simple... thanks! the File / generate M-file provided such a complicated answer without using the hist function

Subject: create histogram

From: Pink Panther

Date: 5 Jan, 2011 15:22:05

Message: 5 of 6

"Wayne King" <wmkingty@gmail.com> wrote in message <ig20b5$p5m$1@fred.mathworks.com>...
> "Pink Panther" wrote in message <ig1vf1$rto$1@fred.mathworks.com>...
> > hi,
> > what could be the code to create a histogram out of vector ? for example, let's take a normalized random serie
> > V=normrnd(0,5,50,1);
> > I'd like to write the code to create a histogram out of these 50 lines. Obviously in this case the histogram should very much look like a bell curve mean 0 std deviation 5, and the idea could be applied to any type of data
> > many thanks in advance
>
> Hi, do you mean beside?
>
> hist(V)
>
> Wayne
no, in fact the Generate M-file got me lost in a complicated solution using patch and other weird -to me- stuff, while hist is so nice and simple. thanks anyway, and have a good year

Subject: create histogram

From: Steven_Lord

Date: 5 Jan, 2011 18:23:30

Message: 6 of 6



"Pink Panther " <huguesrialan@gmail.com> wrote in message
news:ig22at$bd9$1@fred.mathworks.com...
> "Wayne King" <wmkingty@gmail.com> wrote in message
> <ig20b5$p5m$1@fred.mathworks.com>...
>> "Pink Panther" wrote in message <ig1vf1$rto$1@fred.mathworks.com>...
>> > hi, what could be the code to create a histogram out of vector ? for
>> > example, let's take a normalized random serie
>> > V=normrnd(0,5,50,1);
>> > I'd like to write the code to create a histogram out of these 50 lines.
>> > Obviously in this case the histogram should very much look like a bell
>> > curve mean 0 std deviation 5, and the idea could be applied to any type
>> > of data
>> > many thanks in advance
>>
>> Hi, do you mean beside?
>>
>> hist(V)
>>
>> Wayne
> no, in fact the Generate M-file got me lost in a complicated solution
> using patch and other weird -to me- stuff, while hist is so nice and
> simple. thanks anyway, and have a good year

If you used HIST and then generated a file, then yes -- how is "Generate
M-file" supposed to know that the graphics from which it's being asked to
generate code was created from a call to HIST? It doesn't. All it knows is
that there are some graphics objects (which you and I know were created by
HIST) in the figure, so it generates code to faithfully reproduce those
graphics objects.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlab.wikia.com/wiki/FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us