Illustrations of calling the rand function, MATLAB Programming

Illustrations of calling the rand function:

The function ‘rand’ can be used to produce random real numbers; calling it produces one random real number in the range from 0 to 1. There is no argument passed to the rand function. Here are two illustrations of calling the rand function:

>> rand

ans =

0.9501

>> rand

ans =

0.2311

The seed for the rand function will always be similar each time the MATLAB is started, unless the state is changed, for illustration shown:

 

rand(‘state’,sum(100*clock))

 

This uses the present date and time which are returned from the built-in clock function to set the seed. Note: this is completed only once in any given MATLAB session to set the seed; the rand function can be used as shown earlier in any number of times to produce random numbers.

As rand returns a real number in the range from 0 to 1, multiplying the answer by an integer N would return the random real number in a range from 0 to N. For illustration, multiplying by 10 returns a real in the range from 0 to 10, therefore this expression

rand*10

would return the outcome in the range from 0 to 10.

Posted Date: 10/18/2012 4:04:17 AM | Location : United States







Related Discussions:- Illustrations of calling the rand function, Assignment Help, Ask Question on Illustrations of calling the rand function, Get Answer, Expert's Help, Illustrations of calling the rand function Discussions

Write discussion on Illustrations of calling the rand function
Your posts are moderated
Related Questions
Write a MATLAB program that calculates the arithmetic mean, and the root-mean-square average for a given set of values. The output should be formatted as follows: Y

Appending data to a data File: A text file once exists; the data can be appended to it. The format is similar as formerly, with the addition of the qualifier -append. For illu

Write a function that solves a system of linear equations or calculates the inverse of a matrix by Gauss-Jordan elimination. Your function should accept a matrix as an argument and

Scripts to Produce and Customize the Simple Plots: The MATLAB has many graphing capabilities. In most cases, customizing plots are desired and this is the simplest to accompli

Using numerical techniques, plot the intensity distribution for LP 01 and LP 11 modes. Vary the value of V (reduce it to 1.5) and plot several of the intensity plots (of LP 01 )

Variables and Assignment Statements: A variable is used in order to store a value in a MATLAB session, or in a program. The Workspace Window represents variables which have be

wite a function that will take In a simplex an an associated and return the nitial feasible solution of the tableau x as a column vector as well as the objective the objective fun

Characters and Encoding: A character in a MATLAB is represented by using single quotes (example, 'a' or 'x'). The quotes are essential to denote a character; without them, the


how to write a program to determine the day of the week. using GUI.