Please check if my Matlab code is correct

Please find attached tutorial

On page 9 no.3

I try the following code but I do not think that it is correct;

Can someone please check it for me
I = normrnd(5,1);
hist(I)

Open in new window

LVL 1
jtiernan2008Asked:
Who is Participating?
 
masheikCommented:
include x axis values
x = 0:1:10;
I= normrnd(5,1);
hist(I,x)
0
 
jtiernan2008Author Commented:
thanks a million Lunchy

@masheik hist(I,x) brings up the same results, I changed hist(I,x) to hist(x,I)
Is this correct?
0
 
yuk99Commented:
Did you actually get the correct answer? Because you problem is that you get only one number from I=normrnd(5,1);

You need to specify the size of result.
I=normrnd(5,1,100,1);
hist(I)

It's not necessary to specify x for hist, only if you need it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.