function m=cmean(x,f) %x is set of values, f proportional to probability density function at these values %then m=mean m=sum(x.*f)/sum(f);