Uniform random variable - GaussianWaves (2024)

Uniform random variable - GaussianWaves (1)Uniform random variable - GaussianWaves (2)Uniform random variable - GaussianWaves (3)Uniform random variable - GaussianWaves (4)Uniform random variable - GaussianWaves (5) (9 votes, average: 3.89 out of 5)

Uniform random variables are used to model scenarios where the expected outcomes are equi-probable. For example, in a communication system design, the set of all possible source symbols are considered equally probable and therefore modeled as a uniform random variable.

The uniform distribution is the underlying distribution for an uniform random variable. A continuous uniform random variable, denoted as Uniform random variable - GaussianWaves (6), take continuous values within a given interval Uniform random variable - GaussianWaves (7), with equal probability. Therefore, the PDF of such a random variable is a constant over the given interval is.

This article is part of the book
Wireless Communication Systems in Matlab (second edition), ISBN:979-8648350779 available in ebook (PDF) formatand Paperback (hardcopy) format.

$$ f_X(x) = \begin{cases}\frac{1}{b-a} & \text{when } a < x < b\\0 & \text{otherwise} \end{cases} $$

In Matlab, rand function generates continuous uniform random numbers in the interval Uniform random variable - GaussianWaves (8). The rand function picks a random number in the interval Uniform random variable - GaussianWaves (9) in which the probability of occurrence of all the numbers in the interval are equally likely. The command rand(n,m) will generate a matrix of size Uniform random variable - GaussianWaves (10). To generate a random number in the interval Uniform random variable - GaussianWaves (11) one can use the following expression.

a + (b-a)*rand(n,m); %Here nxm is the size of the output matrix

To test whether the numbers generated by the continuous uniform distribution are uniform in the interval Uniform random variable - GaussianWaves (12), one has to generate very large number of values using the rand function and then plot the histogram. The Figure 1 shows that the simulated PDF and theoretical PDF are in agreement with each other.

a=2;b=10; %open interval (2,10)X=a+(b-a)*rand(1,1000000);%simulate uniform RV[p,edges]=histcounts(X,'Normalization','pdf');%estimated PDFoutcomes = 0.5*(edges(1:end-1) + edges(2:end));%possible outcomesg=1/(b-a)*ones(1,length(outcomes)); %Theoretical PDFbar(outcomes,p);hold on;plot(outcomes,g,'r-');title('Probability Density Function');legend('simulated','theory');xlabel('Possible outcomes');ylabel('Probability of outcomes');

On the other hand, a discrete random variable generates Uniform random variable - GaussianWaves (14) discrete values that are equally probable. The underlying discrete uniform distribution is denoted as Uniform random variable - GaussianWaves (15), where Uniform random variable - GaussianWaves (16), is a finite set of discrete elements that are equally probable as described by the probability mass function (PMF)

$$f_X(x)= \begin{cases}\frac{1}{n} & \text{where } x \in {s_1,s_2,…,s_n } \\ 0 & otherwise \end{cases} $$

There exist several methods to generate discrete uniform random numbers and two of them are discussed here. The straightforward method is to use randi function in Matlab that can generate discrete uniform numbers in the integer set Uniform random variable - GaussianWaves (17). The second method is to use rand function and ceil the result to discrete values. For example, the command to generate Uniform random variable - GaussianWaves (18) uniformly distributed discrete numbers from the set Uniform random variable - GaussianWaves (19) is

X=ceil(n*rand(1,100));

The uniformity test for discrete uniform random numbers can be performed and it is very similar to the code shown for the continuous uniform random variable case. The only difference here is the normalization term. The histogram values should not be normalized by the total area under the histogram curve as in the case of continuous random variables. Rather, the histogram should be normalized by the total number of occurrences in all the bins. We cannot normalized based on the area under the curve, since the bin values are not dense enough (bins are far from each other) for proper calculation of total area. The code snippet is given next. The resulting plot (Figure 2) shows a good match between the simulated and theoretical PMFs.

X=randi(6,100000,1); %Simulate throws of dice,S={1,2,3,4,5,6}[pmf,edges]=histcounts(X,'Normalization','pdf');%estimated PMFoutcomes = 0.5*(edges(1:end-1) + edges(2:end));%S={1,2,3,4,5,6}g=1/6*ones(1,6); %Theoretical PMFbar(outcomes,pmf);hold on;stem(outcomes,g,'r-');title('Probability Mass Function');legend('simulated','theory');xlabel('Possible outcomes');ylabel('Probability of outcomes');

Uniform random variable - GaussianWaves (21)Uniform random variable - GaussianWaves (22)Uniform random variable - GaussianWaves (23)Uniform random variable - GaussianWaves (24)Uniform random variable - GaussianWaves (25) (9 votes, average: 3.89 out of 5)

Topics in this chapter

Random Variables - Simulating Probabilistic Systems
● Introduction
Plotting the estimated PDF
● Univariate random variables
Uniform random variable
Bernoulli random variable
Binomial random variable
Exponential random variable
□ Poisson process
□ Gaussian random variable
□ Chi-squared random variable
Non-central Chi-Squared random variable
Chi distributed random variable
□ Rayleigh random variable
□ Ricean random variable
□ Nakagami-m distributed random variable
Central limit theorem - a demonstration
● Generating correlated random variables
Generating two sequences of correlated random variables
Generating multiple sequences of correlated random variables using Cholesky decomposition
Generating correlated Gaussian sequences
Spectral factorization method
Auto-Regressive (AR) model

Books by the author


Wireless Communication Systems in Matlab Second Edition(PDF)
Note: There is a rating embedded within this post, please visit this post to rate it.

Digital Modulations using Python (PDF ebook)
Note: There is a rating embedded within this post, please visit this post to rate it.

Digital Modulations using Matlab (PDF ebook)
Note: There is a rating embedded within this post, please visit this post to rate it.
Hand-picked Best books on Communication Engineering
Best books on Signal Processing
Uniform random variable - GaussianWaves (2024)
Top Articles
Latest Posts
Article information

Author: Arielle Torp

Last Updated:

Views: 6281

Rating: 4 / 5 (41 voted)

Reviews: 80% of readers found this page helpful

Author information

Name: Arielle Torp

Birthday: 1997-09-20

Address: 87313 Erdman Vista, North Dustinborough, WA 37563

Phone: +97216742823598

Job: Central Technology Officer

Hobby: Taekwondo, Macrame, Foreign language learning, Kite flying, Cooking, Skiing, Computer programming

Introduction: My name is Arielle Torp, I am a comfortable, kind, zealous, lovely, jolly, colorful, adventurous person who loves writing and wants to share my knowledge and understanding with you.