See this piece of code:
f = exp(-(1/(2*h^2))*(l-x(i)).^2)/sqrt(2*pi)/h;
In this f is a point and l is a vector. So in first place you are plotting point against a vector so it will be very difficult to see. Make fhat an array.
Note: I will strongly recommend you to see this link. Never plot anything inside for loop until it's very necessary to do that.