ksdensity-func
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.
where n is the size of vector vX, is the ith element in vector vX.