3.5.3.7.7 Ksdensity

Definition:

y=ksdensity(x, vX, w) returns the kernel density at x for a given vector vX with a bandwidth w, where an optimal w can be determined by the estimation function kernelwidth.

\text{ksdensity}(x, \text{vX}, w)=\frac{1}{n}\sum_{i=1}^n \frac{1}{\sqrt{2\pi}w}e^{\frac{-(x-\text{vX}_i)^2}{2w^2}}

where n is the size of vector vX, \text{vX}_i is the ith element in vector vX.

Parameters:

x (input, double)
The value to be evaluated for density
\text{vX} (input, vector)
Distributed samples used as kernel centers
w (input, double)
Bandwidth used as kernel scale, w > 0
y (output, double)
Kernel density