Solved

Please check if my Matlab code is correct

Posted on 2009-04-04
5
86 Views
Last Modified: 2016-02-10
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

0
Comment
Question by:jtiernan2008
  • 2
5 Comments
 
LVL 9

Expert Comment

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

Author Comment

by:jtiernan2008
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

by:
masheik earned 500 total points
ID: 24071878
0
 
LVL 15

Expert Comment

by:yuk99
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
java constructor error 8 86
scoreUp challenge 14 48
Vertex form of the function 8 48
Re-position sub-options beneath the TAB 7 39
Have you ever thought of installing a power system that generates solar electricity to power your house? Some may say yes, while others may tell me no. But have you noticed that people around you are now considering installing such systems in their …
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now