Solved

Please check if my Matlab code is correct

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Vertex form of the function 8 65
count7 challenge 12 103
countX 22 83
C/R - what does it mean in postal address 2 68
The purpose of this article is to demonstrate how we can use conditional statements using Python.
When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
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 pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

895 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