[SciPy-User] Porting matlab's ksdensity to scipy

josef.pktd at gmail.com josef.pktd at gmail.com
Wed Aug 4 21:12:48 EDT 2010


On Wed, Aug 4, 2010 at 9:11 PM,  <josef.pktd at gmail.com> wrote:
> On Mon, Jul 19, 2010 at 12:20 PM, Tadas Vilkeliskis
> <vilkeliskis.t at gmail.com> wrote:
>> Hi guys!
>>
>> I am trying to port the code written in matlab to python and I got
>> stuck with matlab's ksdensity function. The matlab code I have looks
>> something like this:
>>
>> [f, x] = ksdensity(values)
>>
>> I used scipy's gaussian_kde to achieve the same result; however, I
>> modified the matlab's code to f = ksdensity(values, x) and where x are
>> fixed values. When x are fixed gaussian_kde works fine, but this is
>> not what I need. I want to select x based on the input values as in
>> [f, x] = ksdensity(values) which returns x based on the input. Is
>> there a way to do this in scipy? For instance, if I have input values
>> [0, 1, 40, 2, 3, 2] how do I get the range of x values?
>
> isn't this just x = np.linspace(values.min(), values.max(), 100)  ?
>
> from only a quick look at the matlab help:
> "The density is evaluated at 100 equally spaced points that cover the
> range of the data in x"
>
> Josef

Ignore if this is too late, I just realized that I got some old emails today.

Josef


>
>>
>> Thank you very much.
>>
>> Tadas
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User at scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user
>>
>



More information about the SciPy-User mailing list