# Compute and plot Rayleigh Distribution probability density function

5 views (last 30 days)
Jose Iglesias on 6 Feb 2022
Commented: Jose Iglesias on 6 Feb 2022
I am currently trying to plot the 90 and 50 percent fading ranges for three independent samples.Theh following code is for consecutive comvutions of pdf. I am able to get the cumative distribtion plot but I am having trouble converting it to the respective Rayleigh distribution pdf plot in order to find my upper and lower bound ranges. I know that the plot I need is the raylpdf function if I am not mistaken but I keep getting errors when I try to convert my plot. The code I am currently using is shown below: i am alsp attaching a pic of my current plot and the Rayleigh distribution pdf plot I am trying to convert it to.Thank you for your assistance.
N = 300;
a = 0;
b = 3;
delta = (b-a)/N;
x = linspace(a,b,N);
v = 2*x.*exp(-x.*x);
v1 = 18*x.*exp(-x.*x*9);
v2 = v1;
v3 = v1;
v4 = conv(v1,v2)*delta;
v1 = conv(v4,v3)*delta;
x = [0:3*N-3]*delta;
vcdf = cumsum(v1)*delta;
%plot(x(1:100),y,v,v1,'--');
plot(x,vcdf);
xlim([0,3]);
%legend('Rayleigh Distribution'. 'New Distribution');
xlabel('x (\sigma^(2)=0.5)');
title('(\bf Fig 2): cdf of New Distribution')

VBBV on 6 Feb 2022
Edited: VBBV on 6 Feb 2022
plot(x,v1,'--',x(1:300),v);
axis([0 3 0 2])
Compare it with same vector lengths to view the Pdf
Jose Iglesias on 6 Feb 2022
It worked like a charm! Thank you so much!!

### Categories

Find more on Birnbaum-Saunders Distribution in Help Center and File Exchange

R2020a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!