**Generation of Random Numbers (“rand” command):**

The thousand random numbers are generated by the following MATLAB command. In the following table 1, 100 of the 1000 generated random numbers are shown.

>> a=rand(1000,1)

**Random Number Sorting:**

>> b=sort(a)

The sorted numbers (100 out of the 1000) are shown in table 2.

>> c=mean(b)

c = 0.5089

>> d=median(b)

d = 0.5162

>> e=mode(b)

e = 3.4146e-04

>> f=var(b)

f = 0.0818

>> g=std(b)

g = 0.2860

>> h=bar(b)

h = 174.0016

The standard uniform distribution is the simplest distribution for continuous random variable. In this case the probability of occurrence of each event is same and when the probability of occurrence is plotted against the numbers, it gives a horizontal line. In standard uniform distribution, the lowest boundary is 0 and the highest boundary is 1. So, the area under the horizontal line always gives 1. The distribution is rectangular in shape which is defined by maximum and minimum values.

Figure 1: Showing the bar plot of the uniformly distributed random numbers.

**Generation of Random Numbers (“randn” command):**

The thousand random numbers are generated by the following MATLAB command. In the following table 3, 100 of the 1000 generated random numbers are shown.

>>a=randn(1000,1)

>>b=sort(a)

>> c=mean(b)

c = 0.0512

>> d=median(b)

d = 0.0507

>> e=mode(b)

e = -3.4915

>> f=var(b)

f = 1.0212

>> g=std(b)

g = 1.0105

>> h=bar(b)

h = 174.0031

The standard normal distribution is probably the most useful tool in solving many problems. It is a bell shaped curve and has a peak value at its center. This distribution is symmetric about the mean and also asymptotic (the curve gets closer and closer to the x-axis however never touches the axis). The total area under the curve is 1. The position of a normal distribution is determined by the mean and standard deviation as well.

Figure 2: Showing the bar plot of the normally distributed random numbers

## No comments:

## Post a Comment