Can you write this matlab code please rroiect.1 Part-A: Use a MATLAB software to
ID: 3327159 • Letter: C
Question
Can you write this matlab code please
rroiect.1 Part-A: Use a MATLAB software to generate 1000 vfrmlyded with the given PDF below, by applying a transformation from a uniformly distributed e hi 1000 values of a random variable Y random variable X in the i 1000 points and at the same graph plot the exact PDF equation and en plot the histogram of the generated on and compare l) The exponential PDF f, (y ) = 2e-24(y) 2) The standard Cauchy PDF (1 + y 2) Part-B: Use the MATLAB instruction (randn(N,1) which generates N values of a normalized Gaussian random variable (mean = 0, 1), to generate 1) 100 points 2) 2000 points and then plot the histogram for each case and plot the PDF of the exact normalized Gaussian random variable. Compare and comment on the results. Part-C: Apply the transformation on the 2000 Gaussian points generated in part-B-2, to generate 2000 points of a new random variable Y. Plot the histogram of the Y points and compare to the exact PDF of Y. Hint: According the above transformation, Y is a Gaussian random variable with ( mean = 2, -9)} Part-D: Prove the hint in Part-C.Explanation / Answer
clear all
%% exponential distribution
N=1000;
U=rand(N);
for i= 1:N
x1(i)=-0.5*log(1-U(i));
end
y1=linspace(min(x1),max(x1));
l=2;
exp=2*exp(-2*y1);
hist(x1)
hold on;
plot(y1,exp);
grid on
%% Cauchy distribution
for i= 1:N
x2(i)=tan(pi*(U(i)-0.5));
end
y2=linspace(min(x2),max(x2));
cau=(pi*(1+y2.^2)).^(-1);
hist(x2)
hold on;
plot(y2,cau);
grid on
Similarly you can solve this fornormal distribution.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.