Communications 4
Communications 4
OBJECTIVE: To derive the probability density function of the transformed random variable
analytically and verify the plot using the simulation
THEORY:
The transformation of random variables refers to the process of finding the distribution of a new
random variable Y, which is a function of an original random variable X. This is a fundamental
concept in probability theory and statistics, commonly used when we want to analyze how
applying a function or transformation to a random variable affects its distribution.
Types of Transformations
o Discrete Random Variables: For a discrete random variable XXX with probability mass
function P(X=x)), the new random variable Y=g(X) will have a probability mass function:
P(Y=y)=P(g(X)=y)
This involves determining the possible values of Y and summing the probabilities of the
corresponding X values.
fY(y)=fX(g−1(y)⋅∣dg−1(y)/ dy∣
This method involves finding the inverse of g and adjusting for the scaling factor (derivative
of the inverse).
fY(y)=fX(x)⋅∣det(J(y))∣
where J is the Jacobian matrix of partial derivatives describing the transformation from X to Y
which is given by
CODE:
a. y=h2
%Simulation of transformed rv
hold on;
N=6000;
b=30;
h=random('Rayleigh',sigma,[1,N]);
transformed_variable=h.*h;
[ct,cn]=hist(transformed_variable,b);
A=trapz(cn,ct);
pdf=ct./A;
plot(cn,pdf,'*');
xlabel('Random variable x');
ylabel('f(x)');
title('Probability Density Function of transformed variable=h^2')
legend('Analytical','Simulated');
grid on;
b. y=h3
%Simulation of transformed rv
hold on;
N=5000;
b=30;
h=random('Rayleigh',sigma,[1,N]);
transformed_variable=(h.*h).*h;
[ct,cn]=hist(transformed_variable,b);
A=trapz(cn,ct);
pdf=ct./A;
plot(cn,pdf,'*');
xlabel('Random variable x');
ylabel('f(x)');
title('Probability Density Function of transformed variable=h^3')
legend('Analytical','Simulated');
grid on;
c. y=e-h
%Simulation of transformed rv
hold on;
N=9000;
b=20;
h=random('Rayleigh',sigma,[1,N]);
transformed_variable=exp(-h);
[ct,cn]=hist(transformed_variable,b);
A=trapz(cn,ct);
pdf=ct./A;
plot(cn,pdf,'*');
xlabel('Random variable y');
ylabel('f(y)');
title('Probability Density Function of transformed variable=e^-h')
legend('Analytical','Simulated');
grid on;
d. Y=aX+b
%Simulation of transformed rv
hold on;
N=6000;
b=20;
h=random('Normal',mu,sigma,[1,N]);
transformed_variable=(a1.*h)+b1;
[ct,cn]=hist(transformed_variable,b);
A=trapz(cn,ct);
pdf=ct./A;
plot(cn,pdf,'*');
xlabel('Random variable y');
ylabel('f(y)');
title('Probability Density Function of transformed variable=ax+b')
legend('Analytical','Simulated');
grid on;
e. Z=X*Y
• y=h2
• y=h3
• y=e-h
• Y=aX+b
• Z=X*Y
CONCLUSION:
In this experiment, we learnt how to derive probability density function of a random variable if it is function of
another random variable of a certain distribution and plotted the respective analytical graphs and verified using
simulations.