help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Calculating CDFs from PDFs


From: Joe Koski
Subject: Calculating CDFs from PDFs
Date: Wed, 01 Sep 2004 13:57:54 -0600
User-agent: Microsoft-Entourage/10.1.4.030702.0

With the octave hist function, I'm calculating approximate probability
density functions for some experimental data, and it is working well.

To get the cumulative distribution function from the probability
distribution, I reverted to my Fortran roots and wrote

% calculate cdf from pdf
  sum_pdf=0;
  for i = 1:num_bins
    sum_pdf=sum_pdf+pdf(i);
    cdf(i)=sum_pdf;
  end

which also works well.

Question: is there a way of calculating cdf without resorting to the for
loop? The for loop approach seems very un-octave to me.

Obviously, this is not urgent, but perhaps educational.

Joe



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]