From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: PDF to CDF in MATLAB
Date: Mon, 14 Jan 2013 01:24:12 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 9
Message-ID: <kcvmns$rgv$>
References: <kcv2ip$mv1$> <kcvat3$k7t$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1358126652 28191 (14 Jan 2013 01:24:12 GMT)
NNTP-Posting-Date: Mon, 14 Jan 2013 01:24:12 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:786498

"Roger Stafford" wrote in message <kcvat3$k7t$>...
> "Hemming" wrote in message <kcv2ip$mv1$>...
> > Im trying to extract a scattering angle for a photon using the Klein-Nishina scattering angle distribution (KN in the code) and for this I need the CDF (of KN) to be able to use the Monte Carlo method when that is achieved. All i've managed so far is to plot the PDF between 0 degrees and Pi to see that it looks alright, and that it has that "peanut shape". Ive tried to use the built in CDF function but it seems very slow.
> - - - - - - - - - -
>   Do I understand correctly that this is a probability density function with respect to a solid angle of scattering?  Wouldn't that need to be known in obtaining a cumulative distribution? .......
- - - - - - - - - -
  One more thought about your question.  If it is solid angle that the probability density is taken with respect to, then its cumulative distribution in terms of scatter angle is easy to find.  However if it is this scattering you wish to simulate in a Monte Carlo process using matlab's 'rand' generator, you would need the inverse of this CDF function and that may not be so easy to calculate.  There are some functions in matlab that may able to help in this.  There is also the alternative of a random procedure using rejection to achieve the proper simulation distribution.  Anyway please give us the details of what it is you wish to do.

Roger Stafford