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
Digging the Dirt: Autonomous Mining Robots   Mining is a multi-billion dollar industry and a critical part of the Australian economy. Much of the day-to-day work on mining sites

How to Start Working withSimpower: 1. In the Simulink screen, open a new "Model" (File àNewà Model), name it and save it. 2. Expand the SimPowerSystems library, select and

Linear indexing: This is termed as linear indexing. It is generally much better style when working with the matrices to refer to the row and column indices, although. An in

how to find matrix inverse using matlab command

what are data collect this topic,how i can create algorithm in mat lab what language support easy to this topic

Write a script to determine the volume of a pyramid, which is 1/3 * base * height, where the base is length * width. On time the user to enter values for the length, width, and th

Plot way forms for the following modulation schemes using Mathlab: a)      2 ASK                     b)  BFSK                        c) BPSK 4 ASK

Compare results/performance with tridiagonal Gaussian elimination solver for the problem arising from -y''=f   on (0,1) with y(0)=0=y(1). You may also need to use sparse storage an

Problem 1.  Use Matlab to solve the following system of linear equations: 2x + y + 3z = 1 2x + 6y + 8z = 3 6x + 8y + 18z = 5 Capture Matlab code and the result in a text fi

The cost of sending a package by an express delivery service is $15 for the first two pounds, and $4.25 for each pound over two pounds. Write a program that computes the cost of