Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Generate Probability Denisity function from a uniform one

Status
Not open for further replies.

frigi64

Newbie level 3
Newbie level 3
Joined
Mar 27, 2006
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,313
Hello,
I was wondering if anyone knew (or could direct me) of how to generate any probability density function from from a uniform distribution. For example from uniform to Rayleigh (or exponential).

I am interested both in the mathematical derivation and the software implementation (Matlab).

Thanks.
 

Hi,

It is very simple!!
You have pass the uniform data (between 0 and one) through the inverse cdf (cumulative distribution function) of the required Distribution. ie if you want to generate a distribution with cdf as 1-exp(-x) for x>0 you have to use -ln(1-x).
the code is also simple:

X=rand(1,1e4);
Y=-log(1-X);
hist(Y,50)

Hope it helped.
dspman
 

Re: Generate Probability Denisity function from a uniform o

Hello,

Thanks for your response.
I am confused as to why you are using -In(1-x);

According to https://en.wikipedia.org/wiki/Exponential_distribution
the inverse cdf of the exponential is:

1 - exp(-lambda*x);

From your explanation:
You have pass the uniform data (between 0 and one) through the inverse cdf (cumulative distribution function) of the required Distribution.

Working from there I thought that this is what the code should look like:

X=rand(1,1e4);
Y = 1 - exp(-lambda*X);

Where X is the original uniformly distributed data and Y is the exponentially distributed data.

Please let me know if that is correct or if I completely missed the gist of what you were saying.

Thanks.
 

In order to find the inverse cdf of the exponential distribution I have solved Y=1-exp(-X) for X. This is the point. You have to find algebric inverse.
Also if you jenerate the data using the line you have here, I think you can see that the drived data are not exponentially distributed.

Yours,
dspman.
 

Re: Generate Probability Denisity function from a uniform o

this is unavaibale problem???!!!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top