MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > Samples from a distribution 

Subject: Samples from a distribution From: Stas Berlyand Date: 18 Feb, 2009 02:15:06 Message: 1 of 7 
Say that I have some probability distribution function. 
Subject: Samples from a distribution From: Roger Stafford Date: 18 Feb, 2009 05:43:01 Message: 2 of 7 
"Stas Berlyand" <ssb338@nyu.edu> wrote in message <gnfqva$6b0$1@fred.mathworks.com>... 
"Stas Berlyand" <ssb338@nyu.edu> wrote in message <gnfqva$6b0$1@fred.mathworks.com>... 
> Say that I have some probability distribution function. 
Subject: Samples from a distribution From: Pantelis Sopasakis Date: 20 May, 2013 17:20:10 Message: 5 of 7 
It depends how this PDF is represented. For instance, if it is the normal distribution, then you can use MATLAB's function randn. If it's the uniform, you may use rand. If it is some other distribution, like the chisqured, it is sometimes possible to map from the normal, i.e., if f(x) if the pdf of N(0,1) and g(x) is the pdf of your distribution G, you may find a T so that g(x)=T(f(x)), then if X~N(0,1), T(X)~G. 
The Matlab function random does the job: 
This function offers a nice solution: 
No tags are associated with this thread.
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.