Link to home
Start Free TrialLog in
Avatar of jtiernan2008
jtiernan2008

asked on

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

Avatar of masheik
masheik
Flag of India image

include x axis values
x = 0:1:10;
I= normrnd(5,1);
hist(I,x)
Avatar of jtiernan2008
jtiernan2008

ASKER

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?
ASKER CERTIFIED SOLUTION
Avatar of masheik
masheik
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.