Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Please check if my Matlab code is correct

Posted on 2009-04-04
Medium Priority
102 Views

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)
``````
0
Question by:jtiernan2008
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points
• 2

LVL 9

Expert Comment

ID: 24071593
include x axis values
x = 0:1:10;
I= normrnd(5,1);
hist(I,x)
0

LVL 1

Author Comment

ID: 24071693
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

LVL 9

Accepted Solution

masheik earned 2000 total points
ID: 24071878
0

LVL 15

Expert Comment

ID: 24073878
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

## Featured Post

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
Having just graduated from college and entered the workforce, I don’t find myself always using the tools and programs I grew accustomed to over the past four years. However, there is one program I continually find myself reverting back to…R.   So …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
###### Suggested Courses
Course of the Month4 days, 17 hours left to enroll