function f=densest(z,x,c)
%uses kernel to estimate density at points in vector z using data x
%see janicki and weron page 57
n=length(x);
b=c/(n^(1/5));
f=[];
for i=1:length(z)
f=[f mean(kernel((z(i)-x)/b))];
end
f=f/b;