Find and plot the cumulative distribution and probability density functions of a random variable
AIM: To find and plot the cumulative distribution and probability density functions of a given random variable.
OBJECTIVE: To find the cumulative distribution and probability density functions of a given random variable.
EQUIPMENT:
PC with windows (95/98/XP/NT/2007).
MATLAB Software
Plot the CDF of discrete random variable:
PROGRAM:
px1=[0.1 0.2 0.1 0.5 0.1]
x1=[3 5 6 8 9]
x=1:max(x1)
P1=zeros(1,length(x))
for j=1:length(x)
for k=1:length(x1)
if x(j)==x1(k)
P1(j)=px1(k)
end
end
end
k=0
for i=1:length(x)
Fx(i)=k+P1(i)
k=Fx(i)
end
disp(Fx)
subplot(2,1,1)
stem(x,P1)
axis([0 10 0 1])
subplot(2,1,2)
stairs(x,Fx)
axis([0 10 0 1.5])
OUTPUT:
px1 =
0.1000 0.2000 0.1000 0.5000 0.1000 0
x1 =
3 5 6 8 9 12
Fx
Columns 1 through 12
0 0 0 0.1000 0.1000 0.3000 0.4000 0.4000 0.9000 1.0000 1.0000 1.0000
Column 13
1.0000

Plot the PDF of discrete random variable:
PROGRAM:
x=[3 5 6 8 10]
Fx=[0.3 0.4 0.9 1 1]
f1=zeros(1,min(x));
x1=[0:min(x)-1 x]
Fx1=[f1 Fx]
for i=2:length(x1);
Px(1)=Fx1(1);
Px(i)=Fx1(i)-Fx1(i-1);
end
disp('px')
disp(Px)
subplot(2,1,1)
stairs(x1,Fx1)
xlabel('x1')
ylabel('Fx1')
title('CDF of x')
axis([0 10 0 1.1])
subplot(2,1,2)
stem(x1,Px)
xlabel('x1')
ylabel('Px')
title('pdf of x')
axis([0 10 0 1])
OUTPUT:
x =
3 5 6 8 10
Fx =
0.3000 0.4000 0.9000 1.0000 1.0000
x1 =
0 1 2 3 5 6 8 10
Fx1 =
0 0 0 0.3000 0.4000 0.9000 1.0000 1.0000
px
0 0 0 0.3000 0.1000 0.5000 0.1000 0

RESULT: Thus cumulative distribution and probability density functions of a given random variable are plotted
OUTCOME: The Student must be able to understand how to find the cumulative distribution to probability density functions of a given random variable using MATLAB
-
CreatedMar 03, 2020
-
UpdatedMar 03, 2020
-
Views149
Introduction
Basic operations on Matrices
Genaration of various signals and sequences
Operations on signals and sequences
Finding the even and odd parts of signal/sequence and real and imaginary parts of signal
Verification of Linearity and time in-variance properties of a given continuous/discrete system
Linear Convolution
Auto correlation and cross correlation between signals and sequences
Computation of unit sample, unit step and sinusoidal response of the given LTI system and verifying its physical reliability and stability properties
GIBBS phenomenon
Sampling theorem verification
Finding the Fourier transform of a given signal and plotting its magnitude and phase spectrum
Laplace Transforms
Locating the zeros and poles and plotting the pole zero maps in z-plane for the given transfer function
Gaussian Noise
Verification of Wiener- Khinchin relation
Removal of noise by auto-correlation/cross-correlation
Extraction of Periodic signal masked by noise using correlation.
Checking a Random process for stationarity in wide sense
To find a mean and variance of a discrete random variable
To find a moment generating function of a discrete random variable
Computation of Energy of sinusoidal signal
Computation of energy of rectangular pulse
Computation of Average Power
Waveform Synthesis
Find and plot the cumulative distribution and probability density functions of a random variable
Verification of central limit theorem