See the attached files:
1. In line 21 (g) KSDENSITY is called with property "support" set to "positive"
g = ksdensity(X,Xi,'kernel','normal','support','positive','width',h);
and the values are from 0 to 140 for the output.
2. If I call it without property set to positive
f = ksdensity(X,Xi,'kernel','normal','width',h);
I receive values from 9.59e-04 to 34.81, which is the expected output.
3. If I set the range instead
gmod = ksdensity(X,Xi,'kernel','normal','support',[min(X)-1 max(X)+1],'width',h);
the results are also more accurate (hint of edg math engineer), see line 22 (gmod).
Best Answer