Now that we've clarified some things, let me capture my reply in an actual answer.
The issue is that you have defined your X range to cover only places where the estimated PDF has support, because you actually have some data there. If, instead, you extend the range far enough away from the data, then the estimated PDF will go to zero (or at least approach zero).
extendRange = (max(X)-min(X))/2;
Xgrid1 = linspace(min(X) - extendRange,max(X) + extendRange,1000);
pdfEst_1 = ksdensity(X,Xgrid1,'function','pdf');
Exactly how far out you need to go will depend on the kernel you choose for ksdensity.