[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Calculating CDFs from PDFs
From: |
Joe Koski |
Subject: |
Re: Calculating CDFs from PDFs |
Date: |
Wed, 01 Sep 2004 17:37:08 -0600 |
User-agent: |
Microsoft-Entourage/10.1.4.030702.0 |
on 9/1/04 2:02 PM, Jonathan C. Webster at address@hidden wrote:
> try cumsum()
> Jonathan
>
Thanks, that works and is MatLab compatible as well.
Joe
> Joe Koski wrote:
>> 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
>> -------------------------------------------------------------
>>
>>
>
-------------------------------------------------------------
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
-------------------------------------------------------------