0% found this document useful (0 votes)
17 views

Aim: To Study RANDTOOL and Plot Exponential and Normal Random Variable Function

The document discusses using RANDTOOL to generate random samples from exponential and normal distributions and plot histograms of the samples. It generates samples of various sizes and compares plotting the distributions using scripts versus the randtool graphical interface. The conclusion is that randtool provides more meaningful samples for a given distribution and increasing the sample size gives a better understanding of the distribution.

Uploaded by

dipa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Aim: To Study RANDTOOL and Plot Exponential and Normal Random Variable Function

The document discusses using RANDTOOL to generate random samples from exponential and normal distributions and plot histograms of the samples. It generates samples of various sizes and compares plotting the distributions using scripts versus the randtool graphical interface. The conclusion is that randtool provides more meaningful samples for a given distribution and increasing the sample size gives a better understanding of the distribution.

Uploaded by

dipa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

Aim: To study RANDTOOL and plot exponential and normal random

variable function.
RANDTOOL:

Syntax:
Randtool

Description:
randtool opens the Random Number Generation Tool.

The Random Number Generation Tool is a graphical user interface that generates random
samples from specified probability distributions and displays the samples as histograms. Use
the tool to explore the effects of changing parameters and sample size on the distributions.
[1] Exponential Function:
(1.1) For 100 samples:

clc;

m=1;

x=exprv; %export samples of exponential funcion from randtool


x=sort(x); %Sort array elements in ascending or descending order

a= 1/m;

f=a.*exp(-x./m);

plot(x,f) %plots all lines defined by Xn versus fn pairs

Using script: Using randtool:

(1.2) For 1000 samples:


Using script: Using randtool:

(1.3) For 10000 samples:

Using script: Using randtool:

[2] Normal function:


(2.1) For 100 samples:

clc;
clearall;

m=0;
sig=1;

x=normrv; %export samples of normaldistrobution funcion from randtool

x=sort(x); %Sort array elements in ascending or descending order

a= 1/sqrt(2*pi*sig^2);
f=a.*exp(-((x-m).^2./(2*sig.^2)));

plot(x,f) %plots all lines defined by Xn versus fn pairs

Using script: Using randtool:

(2.2) For 1000 samples:


Using script: Using randtool:

(2.3) For 10000 samples:

Using script: Using randtool:

Normal distribution function:


clc;

x=0:0.7:8;
subplot(1,3,1);hist(normrv,x)
title('100 samples');

x=0:0.5:8;
subplot(1,3,2);hist(normrv1,x)
title('500 samples');

x=0:0.3:8;
subplot(1,3,3);hist(normrv2,x)
title('10000 samples');

Exponential distribution function:


clc;
x=0:0.7:8;
subplot(1,3,1);hist(exprv,x)
title('100 samples');

x=0:0.5:8;
subplot(1,3,2);hist(exprv1,x)
title('1000 samples');

x=0:0.3:8;
subplot(1,3,3);hist(exprv2,x)
title('10000 samples');

Conclusion:
The random samples that are generated through randtool are more meaningful for a given
distribution then the samples that are taken randomly through rand command.Also as the
number of samples increases, it tends to give us a bettter idea about a given distribution.

You might also like