Solved

Please check if my Matlab code is correct

Posted on 2009-04-04
5
89 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
algorithm 15 125
How To Loop - Python 19 96
Calculating Percentile Value inside Excel. 2 89
can any US household electrical device/equipment be made to work in asia.. 9 52
This article will show, step by step, how to integrate R code into a R Sweave document
Article by: Nicole
This is a research brief on the potential colonization of humans on Mars.
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

679 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